Reputation: 11
I am trying to produce an activity with an interface somewhat like that of the 'add contact' activity in the standard people application - ie something with a number of lists (email addresses, phone numbers, etc) each of which has a variable number of entries and an 'add' button. The lists themselves don't scroll (ie all entries are shown all of the time), but the overall interface does scroll.
My first attempt uses several listviews inside a linearlayout inside a scrollview; the code adds elements to the listviews as required. However, I cannot find a way to prevent the lists from being scrolled, rather than being shown full length.
Can anyone suggest how I might stop the listviews from scrolling ? Or perhaps suggest a better container than the listview (I don't want to re-invent the wheel) ?
Thanks, Richard
Upvotes: 1
Views: 694
Reputation: 21639
Have you considered using table view instead? It should be possible to make rows clickable. Here is how to create table rows in code in my other answer: How to populate the TableLayout with ImageView dynamically in android jdk?
Upvotes: 1
Reputation: 1006584
The lists themselves don't scroll (ie all entries are shown all of the time), but the overall interface does scroll.
This is incorrect. All entries are not shown all of the time.
My first attempt uses several listviews inside a linearlayout inside a scrollview
You cannot put a ListView
in a ScrollView
.
Or perhaps suggest a better container than the listview (I don't want to re-invent the wheel) ?
The add-a-contact activity uses a ScrollView
wrapped around a LinearLayout
holding each of the "editors".
Upvotes: 0
Reputation: 8142
Maybe ExpandableListView will be more helpfull here. http://developer.android.com/reference/android/widget/ExpandableListView.html for more info
Upvotes: 0