2011-02-10 10 views
0

ボタンは隠されています...なぜですか?あなたはwrap_contentにそれを告げたので、なぜ私のボタンは隠されていますか?

<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は画面全体を埋めるために十分なコンテンツを持っていることになると仮定します。あなたは、ボタンはそれが必要なものを持っていた後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を与える必要があります。あなたのボタンが表示されます。それを試してみてください。

関連する問題