我试图在水平方向的线性布局中拥有一个文本视图和一个按钮。文本视图应该出现在开头,按钮应该出现在结尾。我认为将重力赋予按钮可以解决问题,但按钮不会移动到右侧。我在想我是否应该使用相对布局?
<\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>