Q:

ExpandableListView takes all width of parent view. Android

ExpandableListView takes all width of parent view. Android.
I declare it as:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

<ExpandableListView
    android:id="@+id/exListView"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:childIndicatorLeft="0dp"
    android:divider="@android:color/transparent"
    android:groupIndicator="@drawable/list_view_group_indicator"
    android:smoothScrollbar="true" />

<LinearLayout
    android:layout_width="0dip"
    android:layout_height="match_parent"
    android:background="@android:color/black" >
</LinearLayout>

Group view is declared as:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/transparent" />
</LinearLayout>

and child view is declared as:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

<ImageButton
    android:id="@+id/buttonChild"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" />

<TextView
    android:id="@+id/child_button_name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
</LinearLayout>

But still ExpandableListView takes all width of the parent view.
For what reason it can be? All child views declared as wrap_content
Thanks.

A:

Do not use WRAP_CONTENT on ListView.
Measuring ListView with thousands of items can be a really long operation.
You shdould always set MATCH_PARENT or specify width or height in DIP's .

