Rohan Kandwal
Rohan Kandwal

Reputation: 9326

Scrolling & Layout Problems with ExpandableListView

I am developing an app which needs a unscrollable header at the top, Scrollable ExpandableListView in the middle and then unscrollable footer at the bottom. see the image below

sample image

The problem is Scrollable property of ExpandableListView, when i expand parent view of the ExpandableListView, list scroll under footer, unscrollable, which is the problem. See below problem

here's the xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F2B1DBF3"
android:orientation="vertical" >

<include
    android:id="@+id/callheader"
    android:layout_alignParentTop="true"
    layout="@layout/callerheader" />

<ExpandableListView
    android:id="@+id/exSavedVoiceList"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/callheader"
    android:groupIndicator="@drawable/drawableanimation"
    android:paddingLeft="10dp" >
</ExpandableListView>

<LinearLayout
    android:id="@+id/llbottom"
    android:layout_width="match_parent"
    android:layout_height="50sp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:background="#ff33b5e5"
    android:gravity="center"
    android:orientation="vertical" >

    <Button
        android:id="@+id/bSaveNewVoice"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#ff33b5e5"
        android:contentDescription="@string/add_new"
        android:drawableLeft="@drawable/setting"
        android:drawablePadding="40dp"
        android:text="@string/add_new"
        android:textColor="#FFFFFF"
        android:textSize="25sp" />
</LinearLayout>

If i put android:layout_below="@+id/exSavedVoiceList" in llbottom (LinearLayout), footer moves below if parent view is expanded.

problem 2

Please provide a solution with a possible explaination.

Upvotes: 0

Views: 4568

Answers (2)

Hareshkumar Chhelana
Hareshkumar Chhelana

Reputation: 24848

// try this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#F2B1DBF3"
                android:orientation="vertical" >
    <include
            android:id="@+id/callheader"
            layout="@layout/callerheader" />

    <ExpandableListView
            android:id="@+id/exSavedVoiceList"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:layout_below="@+id/callheader"
            android:groupIndicator="@drawable/drawableanimation"
            android:paddingLeft="10dp"/>

    <LinearLayout
            android:id="@+id/llbottom"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#ff33b5e5"
            android:gravity="center"
            android:orientation="vertical" >

        <Button
                android:id="@+id/bSaveNewVoice"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#ff33b5e5"
                android:contentDescription="@string/add_new"
                android:drawableLeft="@drawable/setting"
                android:drawablePadding="40dp"
                android:text="@string/add_new"
                android:textColor="#FFFFFF"
                android:textSize="25sp" />
    </LinearLayout>
</LinearLayout>

Upvotes: 1

rupesh
rupesh

Reputation: 129

Please add android:layout_above="@+id/llbottom" to your expandablelistview. and don't add android:layout_below="@+id/exSavedVoiceList" to your llbottom layout.

Upvotes: 0

Related Questions