6

下の図に示すように、4 つの解像度フォルダーを作成し、それぞれに適切な画像サイズを配置しました。

ここに画像の説明を入力

下の図に示すように、さまざまな画面サイズ用に 8 つの異なるレイアウト フォルダーも作成しました。

ここに画像の説明を入力

下の図でわかるように、各 XML ファイルの画像のサイズを変更して、画面いっぱいに表示する必要があります。

ここに画像の説明を入力

このコードを使用して、正常に機能する画像を縮小します。

android:adjustViewBounds="true"  
    android:maxWidth="150dp" 
    android:scaleType="fitCenter"

しかし、画像を拡大する方法がわかりません。私はこのコードを使用しようとしています:

android:adjustViewBounds="true"  
    android:minWidth="150dp" 
    android:scaleType="fitCenter"

画像を拡大する方法についてのアイデアはありますか? ありがとうございました!!

XML:

    <ImageButton
    android:id="@+id/btnPlay"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_below="@+id/imageView1"
    android:layout_marginTop="15dp"
    android:background="@null"
    android:src="@drawable/btn_play"
    android:adjustViewBounds="true"  
    android:scaleX="1.5"
    android:scaleY="1.5"
    android:scaleType="fitXY"  />
4

3 に答える 3

9

やってみました?:

android:scaleX="1.5" // 1 is 100% size
android:scaleY="1.5"
于 2013-07-25T04:47:55.090 に答える
1

代わりに試してくださいandroid:scaleType="fitXY" android:scaleType="fitCenter"

編集

LinearLayoutで使用layout_weight and weightSum

調整のようWeighSumに、あなたにlayout_weight応じてUI

 <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="8" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="3" >

        <!-- your Match m Image -->
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:background="#fff" >

        <!-- your play image -->
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <!-- your Multiplayer image -->
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <!-- your High score Image -->
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <!-- your how to play Image -->
    </LinearLayout>
</LinearLayout>
于 2013-07-25T04:48:09.460 に答える
0

これには、新しいサイズ修飾子を使用する必要があります。それが最善の方法です。あなたがしていることは間違っていませんが、非常に多くの異なる種類のデバイスで時代遅れになっています. これを参照

于 2013-07-25T09:58:41.110 に答える