2013-10-05 57 views
0

我开发一个应用程序在顶部需要unscrollable头,在底部中间,然后unscrollable页脚滚动ExpandableListView。见下面的图像滚动和布局问题与ExpandableListView

sample image

的问题是ExpandableListView滚动属性,当我扩大下页脚,unscrollable的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

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

回答

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> 
+0

去工作完全没有问题,但你能告诉我什么是'RelativeLayout' –

+0

我们给Android的问题:layout_weight =” 1“扩展列表视图如果我们有LinearLayout作为父母和你的情况LinearLayout它更好的解决方案。 –

+0

我明白你在'LinearLayout'中做了什么,但我只是想知道在使用'RelativeLayout'时出了什么问题。特别是为什么底栏也可以跟'ExpandableListView'一起滚动。 –

0

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

+0

现在,当我展开所有'父views'那么最后一个下'llbottom' –