水平方向の線形レイアウトでテキストビューとボタンを作成しようとしています。テキストビューは最初に表示され、ボタンは最後に表示されます。ボタンに重力を与えるとうまくいくと思ったのですが、ボタンが右側に移動しません。おそらく相対レイアウトを使用する必要があるかどうかを考えていますか?
<\LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/productPriceTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rs 3579.0"
/>
<Button
android:id="@+id/buyNowButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Buy Now" />
<\/LinearLayout>