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