22

Layout_width="fill_parent「」とを使用 しLayout_height="wrap content"ます。画像がImageViewよりも大きい場合、完全に縮小されます。

ただし、小さい画像をアップスケールするために機能させることはできませんでした。ScaleTypeと「AdjustViewBounds」の任意の組み合わせを試しました。画像ビューの中央で常に独自のサイズのままです。これがコードです...

 <LinearLayout
        android:id="@+id/LinearLayout02"
        android:layout_height="wrap_content"
        android:background="@drawable/content_bg"
        android:orientation="vertical"
        android:padding="5dp"
        android:layout_width="fill_parent"
        android:layout_marginLeft="1px">
        <ImageView
          android:layout_height="wrap_content"
          android:src="@drawable/test"
          android:id="@+id/ImageViewTest"
          android:layout_width="fill_parent"
          android:adjustViewBounds="true"
          android:scaleType="center"></ImageView>
</LinearLayout>
4

4 に答える 4

5
<LinearLayout
    android:layout_height="wrap_content"

内部の画像の元のサイズを使用します。

より大きなものまたはfill_parentを試してください

于 2011-09-08T15:18:46.023 に答える
2

android:scaleType="FIT_START"またはを使用android:scaleType="FIT_END"して、元の src アスペクト比を維持するスケールを計算しますが、src が完全に dst (GoogleDev から) 内に収まるようにします。

より詳しい情報:

http://developer.android.com/reference/android/widget/ImageView.ScaleType.html

于 2011-11-07T13:16:32.577 に答える
1

android:scaleType="fitXY"サイズが小さい場合、ImageView に追加 すると画像が引き伸ばされます。

于 2010-09-24T08:51:44.920 に答える