Sumit Patel Sumit Patel - 1 year ago 137
Android Question

Focus ScrollView On Top Of Page in android

I am having an Activity in which I am having some View that is textViews ImageViews and MapView and last is listview on the page.

All these controlls are in a scroll view. The problem is that when the list view populates the scroll scrollview is also scrolls to the listview. The focus is not on the top of page is always on bottom of the page.

I also used

for Listview in xml and in code
But this is not working, so please suggest any alternatives.

Answer Source

Vipin is correct in that you can't do a listview inside a scroll view. You could also setup a tablelayout that is made dynamic in Java based off how many items are in your cursor (for loop).

So in other words, setup your XML with a scroll view. Add items to it that will show at the top, then at bottom put your table. Build table in Java with buildRow(). Then call it after you call your setContentView(R.layout.xmllayout);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download