2013-10-05 59 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' –