私は同じ質問をしましたが、質問のリンクは次のとおりです。アンドロイドで、あるレイアウトでボタンの半分を表示し、別のレイアウトで半分を表示するにはどうすればよいですか? この問題の解決策は見つかりませんでした。このレイアウトをすべてのデバイスでレスポンシブにしたい。誰でもこの問題を解決するのを手伝ってくれます。
1 に答える
2
これを試してみてください..!それが役立つかどうか教えてください.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#d67070">
<RelativeLayout
android:id="@+id/relative_layout_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#70a7d6">
<RelativeLayout
android:id="@+id/relative_layout_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/relative_layout_top"
>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
<Button
android:id="@+id/bt_atoz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Button"
android:textColor="#000000"
android:layout_marginRight="10dp"
android:background="#ffffff"
/>
</RelativeLayout>
于 2013-06-14T07:06:18.083 に答える