2013-10-08 48 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提到的代码 –

相关问题