滚动& ExpandableListView的布局问题

时间:2013-10-05 16:05:12

标签: android xml android-layout scrollview expandablelistview

我正在开发一个应用程序,它需要顶部不可滚动的标题,中间需要Scrollable ExpandableListView,然后底部需要不可滚动的页脚。见下图

sample image

问题是ExpandableListView的Scrollable属性,当我展开ExpandableListView的父视图时,在页脚下列出滚动,不可滚动,这就是问题所在。见下文 problem

这是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>

如果我将android:layout_below="@+id/exSavedVoiceList"放入llbottomLinearLayout),如果展开parent view,则页脚将向下移动。

problem 2

请提供可能解释的解决方案。

2 个答案:

答案 0 :(得分:1)

// 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>

答案 1 :(得分:0)

请将android:layout_above =“@ + id / llbottom”添加到您的expandablelistview中。并且不要将android:layout_below =“@ + id / exSavedVoiceList”添加到您的llbottom布局中。