Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View getHeight() and getWidth() return values too large

I call getHeight and getWidth in a custom view in the onDraw() method. getHeight() returns 1,073,742,549 and getWidth() returns 1,073,742,304. However, when I look at the display metrics for the screen's height and width, I get 800 and 480 respectively. What is getHeight and getWidth returning?

I'm getting the dimensions of my view so I can choose the dimensions of a bitmap that'll go in the view.

Thanks.

like image 239
Jays Avatar asked Apr 09 '12 23:04

Jays


Video Answer


1 Answers

Doesn't explicitly solve you're problem, but curiously:

Width:
1,073,742,304 == 0x400001E0
          480 == 0x000001E0

Height:
1,073,742,549 == 0x400002D5
          725 == 0x000002D5

Any chance this custom view is roughly 725 x 480? I have no idea where that extra 0x40000000 came from, but it looks like it could be almost right except for 1 bit :)

like image 66
Tim Avatar answered Sep 23 '22 12:09

Tim