2013-10-08 50 views
1

我有一個ExpandableListView和一個Button。當我打開列表中的一些項目時,我無法訪問按鈕,因爲列表已擴展。ExpandableListView和滾動

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     > 
     <ExpandableListView 
       android:layout_height="wrap_content" 
       android:layout_width="match_parent" 
       android:id="@+id/expEnt" 
       /> 
    <Button 
      android:layout_height="wrap_content" 
      android:layout_width="100dp" 
      android:text="Plot" 
      android:layout_below="@id/expEnt" 
      android:layout_alignParentRight="true"/> 
</RelativeLayout> 

I can access the button I can't

是否有某種方式來解決這個問題?

+0

layout_heightof的RelativeLayout的應match_parent。但我會建議你使用LinearLayout垂直 –

+0

鋼同樣的問題 – Vitaliy

+0

你試着與linerlayout ID? –

回答

1

試試這個。這將可以幫助你:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     > 
     <ExpandableListView 
       android:layout_height="wrap_content" 
       android:layout_width="wrap_content" 
       android:id="@+id/expEnt" 
       /> 
    <Button 
      android:layout_height="wrap_content" 
      android:layout_width="100dp" 
      android:text="Plot"   
      android:layout_alignParentBottom="true" 
      android:layout_alignParentRight="true"/> 
</RelativeLayout> 
+0

是的,謝謝!我已經做了這樣的事情! – Vitaliy

+0

享受編碼! – Avijit

1

請試試這個:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 

    <Button 
     android:id="@+id/btnPlot" 
     android:layout_width="100dp" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:text="Plot" /> 

    <ExpandableListView 
     android:layout_above="@+id/btnPlot" 
     android:id="@+id/expEnt" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

</RelativeLayout> 
+0

如果在任何時候子元素或父元素增加,並且按鈕仍然變得不可見或觸摸不到,則將以下內容添加到可擴展列表視圖中:android:layout_marginBottom =「75dp」//指定近似值 並使用@Basbous提到的代碼 –

相關問題