1

現在、次のように設定されている 2 つのボタンがあります。

<Button android:id="@+id/ff2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"          
          android:text="Cars"/>

<Button android:id="@+id/ff3"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"          
          android:text="Options"/>
  • 右上隅にある 2 つのボタンを上下に揃える方法
4

4 に答える 4

5

これには LinearLayout を使用するだけです

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:orientation="vertical">

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button 1"
            android:layout_gravity="right" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button 2"
            android:layout_gravity="right" />

    </LinearLayout>
于 2013-05-20T12:37:53.250 に答える
2

RelativeLayoutwithlayout_belowプロパティを使用する

<RelativeLayout
android:layout_width="wrap_content"
          android:layout_height="wrap_content"
>
<Button android:id="@+id/ff2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"          
          android:text="Cars"/>

<Button android:id="@+id/ff3"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below = "@id/ff2"
          android:text="Options"/>
</RelativeLayout>
于 2013-05-20T12:36:16.187 に答える