Android 如何将图像按钮放置在最右边?

Android 如何将图像按钮放置在最右边?,android,imageview,Android,Imageview,我有水平线性布局,包括一个文本视图和一个图像视图。文本的长度不是固定的,我想把图像放在最右边。 我尝试了android:layout\u alignParentRight=“true” 然后android:layout\u marginRight=“0dip” 但是没有什么能正常工作。 请帮忙 您可以在文本视图中设置android:layout\u weight=“1”,无需编写android:layout\u alignParentRight=“true” 范例 <LinearLayou

我有水平线性布局,包括一个文本视图和一个图像视图。文本的长度不是固定的,我想把图像放在最右边。 我尝试了android:layout\u alignParentRight=“true” 然后
android:layout\u marginRight=“0dip”
但是没有什么能正常工作。
请帮忙

您可以在
文本视图中设置
android:layout\u weight=“1”
,无需编写
android:layout\u alignParentRight=“true”

范例

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:orientation="horizontal" >


    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="TextView" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/icn_listarrow" />


为什么不使用RelativeLayout?