Android 并排优先

Android 并排优先,android,image,preferences,Android,Image,Preferences,我希望在偏好活动中有两个偏好并排出现。例如: 来自墙纸:星云人 我试过: imagepref2.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"

我希望在偏好活动中有两个偏好并排出现。例如:

来自墙纸:星云人

我试过:

imagepref2.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingBottom="15dip"
    android:paddingTop="15dip" >

    <ImageView
        android:id="@+id/thumb_1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:src="@drawable/img_1" />

    <ImageView
        android:id="@+id/thumb_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_weight="1"
        android:src="@drawable/img_2" >
    </ImageView>
</LinearLayout>

但这表明:
我想这是因为你的
android:layout\u weight=“1”
是1。 更改为0.5。
并将
android:layout\u width=“wrap\u content”
更改为
android:layout\u width=“0dp”
,在这种情况下,不管布局权重是1还是0.5,因为
LinearLayout
没有定义任何
weightSum
属性。删除重力线,并将布局放置在线性布局上。(对不起,我没有带android,但我试着帮你)诀窍是:android:layout_width=“0dp”,你可以把权重留给1。你能再解释一下你的布局有什么问题吗?我认为结果完全符合您在布局XML中定义的内容。