The answer is you don't use AbsoluteLayout.  Seriously.  It is trivial to
place a button at the bottom right corner of the screen with various other
layout managers, and those will take care of doing the right thing for the
actual screen space.

On Tue, Feb 10, 2009 at 1:03 PM, [email protected]
<[email protected]>wrote:

>
> I've read many posts on the topic of screen width and height, but none
> that answer the big question that seems to come up again and again.
>
> I have an AbsoluteLayout.  I want to place a button in the bottom
> right corner of the screen.  How do I get the size of the viewable
> area so that I know where the bottom right of the screen is?
>
> Things I've tried:
>
> * displayMetrics.heightPixels - but then I have to hard code a guess
> for the status bar size
> * absoluteLayout.getLayoutParams().height - I've never seen reasonable
> numbers coming from this (<= 0)
> * Make the custom view the size of the whole screen, and use the
> canvas object passed into onDraw(), but this object also shows a
> height that doesn't take the status bar into consideration.  If I draw
> something at y=479, it is now viewable because it is off the screen.
>
>
> Thank you,
>
> Matthew
>
>
>
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to