OK
/ボタンを一番下に固定したいCancel
(画面に表示できる項目がリストにある場合でも)。現在の外観は次のとおりです。
ボタンは下ではなく上にあります。
ボタンを含むレイアウト:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="true"
android:id="@+id/buttons_layout">
<TableRow>
<Button
android:id="@+id/btnOK"
android:background="@color/pomegranate"
android:text="OK"
android:layout_gravity="fill_horizontal"
android:layout_weight="1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/btnCancel"
android:background="@color/wet_asphalt"
android:text="Cancel"
android:layout_weight="1"
android:layout_gravity="fill_horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</TableRow>
</TableLayout>
複合レイアウト:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@+id/options_list"
android:layout_width="fill_parent"
android:layout_height="match_parent">
</ListView>
<include layout="@id/buttons_layout"
android:layout_alignParentBottom="true"
android:layout_height="match_parent"
android:layout_below="@id/options_list"/>
</RelativeLayout>
http://developer.android.com/guide/topics/ui/layout/relative.htmlで読んだガイドラインに従いました
私はこの答えを試しました - https://stackoverflow.com/a/6285438/168719 - それは私を助けませんでした。
リストビューは高さを「認識」していないため、機能しない可能性があるのではないかと考えたため、ボタンレイアウトも配置場所を認識していません。しかし、ListView の高さを 100dp などの任意の値に設定することで除外しました。ボタンはまだその上に重ねられています。
すべてのレイアウト属性をいじりましたが、うまくいきません。
解決策とは別に、なぜ私のものがうまくいかないのか知りたいです...