Reputation: 2831
I'm trying to set the ExpandableListView item (ViewGroup
) height. Can it be set via xml (I don't need the divider height):
<ExpandableListView
android:id="@+id/lvExp"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
or it should be used this method, by manipulating the convertView:
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
ViewGroup parent) { ... }
Thanks in advance.
Upvotes: 2
Views: 4825
Reputation: 1173
Question is a bit old, but someone may be useful. As others said, height is not strict value (it changes according to its content). If you want to generally make more space between items (whether it is group or child), you can set padding to corresponding layouts.
This can be done either in XML layout or programmatically in list adapter.
Upvotes: 0
Reputation: 10177
ListView child views can be different heights, so we don't set a one-size-fits all height in the ListView's xml. Rather you can set a specific height in each of the different convertView xml's that you are inflating.
Upvotes: 2
Reputation: 671
Are you trying to set the height of the group row item in the listview? Also the ViewGroup
would be your ExpandableListView
and all of its groups and group children row items.
Or are you asking to set the height of the child items in the expandable list view?
The group item and its children in the listview are the same as any other listview row item.
You can just simply provide fixed height in row layout XML:
android:layout_height="25dp"
Or you could use ViewGroup.LayoutParams
http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html
Upvotes: 0