开发者

ImageView Weight Inverse Scaling

Hey, I'm having some trouble with ImageView in my XML file. My layout is as follows:

<LinearLayout android:id="@+id/row"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <ImageView android:id="@+id/image"
        android:src="@drawable/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"/>
    <TextView android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="hello"
        android:layout_weight="4"/>     
</LinearLayout>

Basically, what I am trying to achieve in something similar to the android contact list, where there is 开发者_如何学编程a picture (taking up about 1/5 width of the screen), followed by a text box with information in the other part of the screen. I tried to use weight to make the TextView more important, and thus receive more space, but that doesn't seem to what.

What's even stranger is that the scale seems to be working in reverse. If I set the weight of the ImageView to something high, like 10, it scales the image down.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜