0

i'm using list view within a scrollview. To avoid the list view not scrollable, i need to het the height of list item and set the listview's height. How to get the list item height while using custom adapter?

Pattabi Raman
  • 5,814
  • 10
  • 39
  • 60
  • 1
    you dont need to put a scroll view within a list view... listviews are automatically scrollable – Shark Jun 15 '12 at 06:00

1 Answers1

0

Remove the parent scrollview... keep the listview as it is... and change height of listview to fill_parent then automatically as new items are populated in the list you can scroll through it to view ones that go out of the screen ... If by setting to fill_parent the ListView forces other views out of the screen manually set the Height by draging the edges in the graphical layout . Either ways no need to use the ScrollView

thanks to @Lalit for pointing out the hazards of setting a ListView to wrap_content

Shark
  • 165
  • 1
  • 10
  • You should never use ListViews layout_height as wrap_content. – Lalit Poptani Jun 15 '12 at 06:03
  • it works perfectly well and just as i expect it to whenever i set t to wrap_content, if that's a wrong practice what should it be set as (genuine question)... anyways certainly a listview shouldnt be within a scrollview? There's no pint doing that , the listview is scrollable within itself... – Shark Jun 15 '12 at 06:11
  • Ok let me clear it by [Proof](http://stackoverflow.com/questions/8340401/weird-behaviour-of-listview-with-checkbox) – Lalit Poptani Jun 15 '12 at 06:13
  • That still raises doubts can you move this to a chat (I dunno how to do it) – Shark Jun 15 '12 at 06:16
  • I am always available in [Casual Chat](http://chat.stackoverflow.com/rooms/1531/casual-chat) – Lalit Poptani Jun 15 '12 at 06:20