2

画面の幅よりも小さいが、画面よりも高さが大きい画像を使用したい。画像全体を使用できるようにスクロールビューを使用することを考えていましたが、フィッティングすると画像の元の比率が変わります。幅を調整し、高さを同じ比率で増やすにはどうすればよいですか?コードは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="@drawable/tutorial"
  > 
  <ScrollView
    android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <ImageView
    android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:scaleType="fitXY"
  android:src="@drawable/tutorial">
  </ImageView>
  </ScrollView>   
</LinearLayout>
4

2 に答える 2

1

使用したいfill_parentを使用しないmatch_parentを使用する

<ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:backround="@drawable/tutorial"/>

于 2013-02-08T04:06:17.867 に答える
0

android:scaleType="CENTER_INSIDE"あなたのそれで使用してくださいImageview

詳細については 、CENTER_INSIDEの詳細をご覧ください。

于 2013-02-08T03:52:29.150 に答える