View.getLocationInWindow() only returns Y (and sometimes not even X)

by Romain Guy » Fri, 29 Jan 2010 06:52:52 GMT


Sponsored Links
 You are probably calling getLocationInWindow() before the layout happened.



>



View.getLocationInWindow() only returns Y (and sometimes not even X)

by ClarkBattle » Fri, 29 Jan 2010 06:53:19 GMT


 Sorry, in that first example I meant;

Log.i("Where?","x=" + loc[0] + " y=" + loc[1] );

not

Log.i("Where?","x=" + where[0] + " y=" + where[1] );

Copy/paste user error :)

--


Sponsored Links


View.getLocationInWindow() only returns Y (and sometimes not even X)

by ClarkBattle » Fri, 29 Jan 2010 06:54:38 GMT


 But its in onStart() while the layout happens in onCreate().  There is
no onFinishInflate() for Activities.  How do i make sure that the
inflation has happened?




> >



Other Threads

1. List Views and Scroll Views

I have a complex layout which has many table rows.Something like this:


<Table Layout>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
         <ListView>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
</Table Layout>



Say now I want a scrollableView for this and I implement the view like this
:

<ScrollView>
<Table Layout>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
         <ListView>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
<TableRow>
</TableRow>
</Table Layout>
</ScrollView>

At this point what happens is that i see just 2 rows of the list coming up.

Now the prob i am facing is that if I remove the scroll view the the whole
list appears.

I do know that in the reference documents,we are suggested not to use Scroll
View with a List View.


As per my requirement,i have a list in which we know that say only 5 rows
are displayed.And then i need the user to be able to scroll the other items
which are external to the list.


How do I accomplish this? Or is it not possible task???

Thanks

--~--~---------~--~----~------------~-------~--~----~

2. Instrumentation Problem

Hello All

I am trying to write an instrumentation project from where I can call
another project(read it as another application)
and execute some tests. is it possible?
I read about requiring 2 android manifest files for this. any good
articles/pointers on this??

Best Regards,
Sudheer

--~--~---------~--~----~------------~-------~--~----~

3. Question regarding StopSelf method that a Service can call

4. Generating tables like lists

5. Adding a new app developed in J2ME to Android SDK 1.0

6. displaying camera preview on my own

7. Unsuccessful Install