为什么隐藏我的按钮?

hun*_*erp 0 layout android

按钮被隐藏了......为什么?

<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>
Run Code Online (Sandbox Code Playgroud)

Che*_*mon 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"/>
Run Code Online (Sandbox Code Playgroud)