2011-06-22 43 views
0

最後のLinearLayoutが表示されないのはなぜですか?LinearLayoutが表示されない

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" android:background="@drawable/bg" android:layout_height="wrap_content" 
android:orientation="vertical" android:padding="2dp" 
android:theme="@android:style/Theme.NoTitleBar"> 

    <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" .../> 

    <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"> 
     <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> 
     // TableRows created dynamically 
     </TableLayout> 
    </ScrollView> 

    <LinearLayout android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_gravity="bottom"> 
     <Button android:layout_height="wrap_content" 
     android:layout_width="wrap_content" android:text="Button" android:id="@+id/button1"></Button> 
    </LinearLayout> 
</LinearLayout>` 

編集:アンドロイド:

+1

は、なぜあなたは真のalignparentBottom = –

答えて

2

を表示するボタンの最後のリニアレイアウト上のコンテンツは、十分なスペースがないことを非常に大きいのでレイアウトとスクロールViewは画面と比較してスペースが大きいので、このライナーレイアウトの最後の子にはViewのスペースがありません。

解決策のために、相対レイアウトを取ることができます。これは、すべての子ビューのlayout_weightを要件に従って配置します。私は最後のオプションはあなたのためのバッターだと思う。

+0

にfill_parentを用いたボトム – coffee

+0

に役立ちます..これについてはこちらをご覧ください[link](http://developer.android.com/resources/tutorials/views/hello-linearlayout.html) – dhams

1

layout_gravity =「下」私は私が望むようアンドロイドレイアウトとほぼ同じ快適ではないが、私はそれがためにあなたのScrollView内に何であってもよいと思います。 ScrollViewのパラメータをwrap_contentに設定します。これは、子が必要とする大きさになることを意味します。しかし、入れ子になったTableLayoutはfill_parentを使用するので、ScrollViewはそれを "継承"し、画面全体を埋め尽くします。もう一度、私はこれが実際に正しいことを保証しません。

+0

でRelativelayoutのために行くscroll down toパソコンへ転送私はちょうどたいだけ幅 – coffee

+0

イムにあるボタンでメニューを作るRelativeLayoutは良好であったが、あなたは答える私はlinerLayoutためlayout_weightを使用 – coffee

1

おそらく最終リニアレイアウトのために残され、それはU子第1のライナーを入れているので、このことが起こるのでしょう

関連する問題