0

API 16 (Jellybean)、4.0 WVGA (480x800: hdpi) を使用しています

背景に480x800の画像を設定しようとしています

「drawable-hdpi」に画像を配置しましたが、この画像は背景に収まりません。4.0 WVGA (480x800: hdpi) を使用し、画像サイズと同じ場合、背景に収まらないのはなぜですか

ドローアブルが画像に合わせてどのように機能するか:

これは私のコードです:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.newapp.Firstscreen$PlaceholderFragment" >

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:src="@drawable/background" />

</RelativeLayout>

スクリーンショットを参照してください:

http://s15.postimg.org/u8rkm6rhn/frghfghfgh.png

4

3 に答える 3

0

この行を ImageView に追加します

 android:scaleType="fitXY"

幅と高さを match_parent として設定します。

于 2014-03-20T09:47:18.853 に答える