0

私はの世界から来ているiOSので、我慢してください。画像のスケーリングと、デバイスによって画像が異なるサイズで表示される理由について少し混乱しています。

私のアプリは大きな背景画像を使用しており、真ん中に他の多くの画像が積み重ねられた順序で配置されています。それらは、背景画像の一部である色付きの領域に配置されます。

ここに画像の説明を入力

異なる電話でレイアウトGraphical Viewを表示すると、個々のタイル画像が異なるサイズで表示されます。暗い灰色の背景ブロック内にすべて含まれる場合もあれば、オーバーフローする場合もあります。小さすぎる場合もあります。

背景画像を作成しています:

<ImageView
            android:id="@+id/backgroundImageView"
            android:layout_width="1000dp"
            android:layout_height="1000dp"
            android:layout_gravity="center"
            android:contentDescription="Background Image"
            android:scaleType="centerCrop"
            android:src="@drawable/background2" />

特定の高さと幅を指定しました。そうしないと、背景画像が小さすぎて、実際のサイズよりもはるかに小さくなります。

左の 2 つの個別画像の例:

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_marginLeft="-7dp" >

    <ImageView
        android:id="@+id/digit5top"
        android:layout_width="wrap_content"
        android:layout_height="37dp"
        android:src="@drawable/top" />

    <ImageView
        android:id="@+id/digit5bottom"
        android:layout_width="wrap_content"
        android:layout_height="37dp"
        android:layout_marginTop="38dp"
        android:src="@drawable/bottom" />
</RelativeLayout>

背景画像と個々のタイル画像をすべてのデバイスで同じサイズ/比率で表示するにはどうすればよいですか?

4

0 に答える 0