2011-02-10 91 views
0

该按钮被隐藏...为什么?为什么我的按钮隐藏?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:padding="15dp" 
    android:orientation="vertical"> 
    <ListView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/feed_list"/> 
    <Button 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="More" 
     android:id="@+id/feed_more"/> 
</LinearLayout> 

回答

6

假设ListView有足够的内容来填满整个屏幕,它会因为你告诉它wrap_content。您可以使用加权指示ListView占用尽可能多的屏幕作为可用时,按钮有什么后,它需要:

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:padding="15dp" 
android:orientation="vertical"> 
<ListView 
    android:layout_width="fill_parent" 
    android:layout_height="0" 
    android:weight="1" 
    android:id="@+id/feed_list"/> 
<Button 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:weight="0" 
    android:text="More" 
    android:id="@+id/feed_more"/> 
1

你需要给重1到列表视图。那么你的按钮将是可见的。尝试一下。