<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/btn1"/>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/btn1"/>
<!--x7-->
私は7つのボタンを相対位置に配置します。そして、私は画面に合わせて同じサイズに '幅'を調整したいと思います。私はあなたが親としてLinearLayout
を使用することができますし、画面全体にフィットすることができないか、それがデバイスに基づいて画面を超える可能性が相対的なレイアウトを使用して、それを達成するためにweight
とweightsum
を与えることができますRelativeLayoutでの自動スケーリングボタンの幅
親としてrelativeLayoutを入れる必要がありますか? –
android:layout_width = "match_parent"は機能しませんか? – Vega
私がrelativeLayoutなしでそれを行うことができるなら、私はrelativeLayoutを親として置かないでしょう。 –