【发布时间】:2011-10-11 17:09:51
【问题描述】:
我使用ImageView,我希望源图片适合TOP和RIGHT。
FitEnd 缩放适合 BOTTOM 和 RIGHT
所有其他比例 enums 也无济于事
有什么想法吗?
谢谢
【问题讨论】:
标签: android imageview image-scaling
我使用ImageView,我希望源图片适合TOP和RIGHT。
FitEnd 缩放适合 BOTTOM 和 RIGHT
所有其他比例 enums 也无济于事
有什么想法吗?
谢谢
【问题讨论】:
标签: android imageview image-scaling
试试这个代码
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top|right">
<ImageView
android:scaleType="fitEnd"
android:adjustViewBounds="true" />
</LinearLayout>
这应该会得到预期的结果。
【讨论】:
我相信您正在寻找 fitStart 或代码中的 setScaleType(ImageView.ScaleType.FIT_START);
使用它,您可以简单地将图像包装在向右对齐的布局包装器中,例如带有android:layout_alignParentRight="true"的RelativeLayout
【讨论】:
只需使用 scaleType = MATRIX
例如:
<ImageView
android:layout_width="%wanted width%"
android:layout_height="%wanted height%"
android:scaleType="matrix"
android:src="%your src%" />
【讨论】: