2

我试图让 ImageView 内的图像缩放以填充高度,保持与左侧对齐,并相应地裁剪宽度以保持宽度/高度比。

Scaletype - centercrop 有点这样做,但对齐图像中心(顾名思义),但我希望图像向左对齐,所以我没有得到图像左侧的任何裁剪。

这是我当前的布局:

<ScrollView android:id="@+id/MainScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:background="#000000"
android:fillViewport="true">

<LinearLayout
android:id="@+id/lineLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" 
android:orientation="vertical">

<RelativeLayout
    android:id="@+id/RelativeLayout1"
    android:layout_width="fill_parent" android:layout_height="93dp">
    <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:src="@drawable/top"
      android:layout_gravity="right"
      android:scaleType="centerCrop" />

有什么建议么?

谢谢。

4

0 回答 0