问题
I want to have a listview menu with few clickable elements and the last element must be an expandable list view item. I mean when i click the last element, an additional positions should be expanded.
thank you!
dejvid
回答1:
You have three options.
Use ExpandableListView where every group-item have no childs-item and the last group-item would have child-items (they would be expanded when the parent group is clicked), there are many examples arround.
Example of ExpandableListView
Use listview and inflate views on the last item when called by getView, you know when you are loading the last position because you receive it on the function.
Example of listview
If you have a small quantity of items consider using a linearlayout to look like a listview and another linearlayout for the last item.
For example
<LinearLayout android:orientation="vertical">
<TextView />
<TextView />
<LinearLayout
android:orientation="vertical"
android:onClik="expand">
<TextView />
<TextView />
</LinearLayout>
</LinearLayout>
来源:https://stackoverflow.com/questions/17700251/android-listview-with-expandable-list-view-item