Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Screen Size Honeycomb Menu android

Hi I am trying yo get the screen size of screen minus the menu bar at the bottom.

I know I could just subtract a constant number according to the resolution of the device but it is a super ugly hack. I am sure google people are not dumb enough to forget to give the user a function to get the height of the bottom menu bar so I can subtract it from the full screen size

This is a similar post. Size of android notification bar and title bar?

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);

what_i_need =metrics.heightPixels-buttomMenuHeight();

I need buttomMenuHeight();

i could not find it in the API. I don't really care about the backward comparability at this point

Thanks

like image 801
user498584 Avatar asked Mar 04 '26 04:03

user498584


1 Answers

Why not use the height of the activity's top-level View? e.g. if your activity contains a full-height LinearLayout, use its height, so you don't have to know the menu height, or noticiation bar height.

I think you're treading a dangerous road doing this kind of calculation, as you don't know what the future layouts for Android might be, or how they might differ on Google TV, or whatever.

like image 145
Ollie C Avatar answered Mar 05 '26 17:03

Ollie C



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!