Reputation: 379
I'm trying to create a settings screen for an app and I like the Gmail app's settings screens. Here is a screenshot:
It looks/behaves like a custom list of some sort. The left side looks like a TwoLineListItem (or just a large TextView and small TextView). The right side is either a checkbox, a blank, or a downward arrow (like ExpandableListView) to indicate you should press it. (ex: when you press the Signature item, a dialog appears so you can input a signature).
I think one tricky part of this is that the entire list item is a "button", meaning you don't have to press directly on the checkbox to check it, you can press anywhere on the list item.
For example, section 5.2 of this tutorial http://www.vogella.de/articles/AndroidListView/article.html requires you tap exactly on the checkbox rather than on the entire list item.
Anyone have any ideas on how this is done?
Upvotes: 1
Views: 321
Reputation: 5208
Hi you can easily define an OnItemClickListener with the setOnitemClickListener() method of the ListView. The Listener is called whenever a list item is touched. In the Listener you can either show the dropdown menu or set the Checkbox to 'checked' with the setChecked(boolean checked)
method of the Checkbox.
Upvotes: 0
Reputation: 3800
This is not the 'normal' listView.
That UI was built with the PreferenceActivity
Always use the PreferenceActivity
to display settings for your application.
Upvotes: 2