Hi Ben,

Sorry for not responding earlier, I don't read this group every day.

It sounds like you are working on an app that runs on the phone.  If so, you
can use code like this to get the absolute screen position of your view:

    EditText nearBottom = (EditText) findViewById(R.id.EditTextNearBottom);
    try {
        int screenLocation[] = new int[2];
        nearBottom.getLocationOnScreen(screenLocation);
        // screenLocation[0] = left, screenLocation[1] = top
        ...
    } catch (Exception ex) {
    ...
    }

Hope that helps.

-Sam

On Fri, Jun 19, 2009 at 5:04 AM, Ben Williamson <tek.bas...@gmail.com>wrote:

> Haha wtf did you need to know? Because my view is chopped off and I would
> like manually set its position. Plus its just polite to post your solution
> when you ask a question, in my view. Thanks though, I'l get it on my own.
>
> On Jun 19, 2009 1:34 AM, "Romain Guy" <romain...@google.com> wrote:
>
> Why do you need to know by how much the window is shifted??
>
> On Thu, Jun 18, 2009 at 10:24 PM, tek <tek.bas...@gmail.com> wrote:
>
>>
>> Please post your solution, I'm interested in this as well.
>>
>>
>> On Jun 13, 2:17 pm, sbq <sbq...@gmail.com> wrote:
>> > Thanks anyway, I found what I'm looking for.
>> >
>> > -Sam
>> >
>> > On Jun 13, 8:34 am, sbq <sbq...@gmail.com> wrote:
>> >
>> >
>> >
>> > > Is there a way to get the window's information from the View?
>> > > I would like to figure out that the window is shifted and by
>> > > how much.
>> >
>> > > On Jun 12, 10:10 pm, Romain Guy <romain...@google.com> wrote:
>> >
>> > > > That's because the window is shifted, not the views within the
>> window.
>> > > > What HierarchyViewer shows is correct.
>> >
>> > > > On Fri, Jun 12, 2009 at 5:56 PM, sbq<sbq...@gmail.com> wrote:
>> >
>> > > > > Greetings,
>> >
>> > > > > I'm interfacing to ViewDebug to get the current position of views
>> in
>> > > > > the phone window.  I have an Android application with an EditText
>> box
>> > > > > near the bottom of the phone's window. When I click on that
>> EditBox,
>> > > > > the soft keyboard is displayed at the bottom of the window and the
>> > > > > EditText box (and everything above it) is pushed up to make room.
>> > > > > Soon after, while the keyboard is still visible, I have a program
>> that
>> > > > > connects to the phone and makes a DUMP request to ViewDebug.  I
>> don't
>> > > > > see this shift reflected in either the mTop or mScrollY of any
>> Views
>> > > > > brought back.
>> >
>> > > > > Is there a way learn about the new position of these Views after
>> the
>> > > > > soft keyboard is displayed?  Alternatively, is there a way to
>> learn
>> > > > > that the soft keyboard is currently being displayed and how far
>> the
>> > > > > phone window was scrolled up -- the amount of scrolling depends on
>> > > > > which EditText control was clicked.
>> >
>> > > > > Since HierarchyViewer uses this same DUMP data, it also does not
>> show
>> > > > > that the Views have been shifted up and some views are not on the
>> > > > > screen -- the absolute_y positions are what they would be if the
>> > > > > keyboard was not there.
>> >
>> > > > > Thanks for any help.
>> >
>> > > > > -Sam
>> >
>> > > > --
>> > > > Romain Guy
>> > > > Android framework engineer
>> > > > romain...@android.com
>> >
>> > > > 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
>>
>>
>
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> 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-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to