Search code examples
androidlistviewandroid-linearlayout

linearlayout doesn't show all childs


I have problem in this layout that : it doesn't show any child after the listView and the listview is filling this sight ; it scrolls but didn't show the any other child

I have tried to user ScrollView but it make issues with expandlist

this is layout xml code:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/select_bg"
android:orientation="vertical" >

<TextView
    android:id="@+id/Header"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/header_bg"
    android:gravity="center"
    android:paddingRight="50dip"
    android:paddingTop="5dip"
    android:text="@string/select"
    android:textColor="#60240a"
    android:textSize="18dip"
    android:textStyle="bold" >
</TextView>

<ListView
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:cacheColorHint="@android:color/transparent"
    android:divider="@drawable/line_divider"
    android:dividerHeight="3dip"
    android:listSelector="@android:color/transparent" >
</ListView>

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="3dip"
    android:src="@drawable/line_divider" />

<ExpandableListView
    android:id="@+id/expandableList"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:cacheColorHint="@android:color/transparent"
    android:childDivider="@drawable/line_divider"
    android:divider="@drawable/line_divider"
    android:dividerHeight="2dip"
    android:listSelector="@android:color/transparent"
    android:textColor="#60240a" >
</ExpandableListView>
</LinearLayout>

Solution

  • When you are using ListView in the layout you have to add this property android:layout_weight for the listview. Without this property being set, you cannot get all views.