<?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:id="@+id/FirstLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/FirstTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_ONE" />
</LinearLayout>
<LinearLayout
android:id="@+id/SecondLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/FirstLinearLayout"
android:orientation="horizontal">
<TextView
android:id="@+id/SecondTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_TWO" />
<TextView
android:id="@+id/ThirdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_Three" />
</LinearLayout>
まず、すべてのコンポーネントを内部に保持するコンテナが必要です。私の例では、私が話しているコンテナはRelativeLayout
. 相対レイアウトを使用すると、対応する ID を使用して子をその位置に配置できます。LinearLayout
を使用して他の 2 つの をどのように配置したかを見てくださいandroid:layout_below="@+id/FirstLinearLayout"
。
それらを同じレイアウトに配置したい場合は、相対レイアウトを使用して、TextView
次のように配置します。
<?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" >
<TextView
android:id="@+id/FirstTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT_ONE" />
<TextView
android:id="@+id/SecondTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/FirstTextView"
android:text="TEXT_TWO" />
<TextView
android:id="@+id/ThirdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/FirstTextView"
android:layout_toRightOf="@+id/SecondTextView"
android:text="TEXT_Three" />
</RelativeLayout>
これがお役に立てば幸いです。