5

Okay, on honeycomb I have some functions that determine the screen size. This is sometimes used to dynamically do some UI stuff. But the problem is that it includes the bottom bar with the android buttons, which subtracts from your available screen size.

The android Display function may be returning the right function (for instance, a 1280x800 display will return 1280x740 as the display, this is the display not including the bottom android buttons) but a javascript function in a webview will only determine that actual size, so 1280x800 gets 1280x800 which is incorrect because the bottom bar is there.

How can I get the size of the bottom bar without hard coding it, I can at least subtract it from incorrect screen size integers this way.

AakashM
  • 62,551
  • 17
  • 151
  • 186
CQM
  • 42,592
  • 75
  • 224
  • 366

1 Answers1

3

I'm not sure this is the best way but here is how I do this (on Android 2.2 but this should also work on 3.x)

  • I create a LinearLayout (FILL_PARENT)
  • I add my own view to it (for example I subclass TextView) and I override onMeasure in it
  • within the onMeasure, I call getParent().getWidth() and getParent().getHeight()

Probably not the answer you were looking/hoping for but at least it works for me.

Marc Van Daele
  • 2,856
  • 1
  • 26
  • 52