私が作成したレイアウトで、x 方向にタイル張りの背景を作成したいと思います。オンラインで見つけたいくつかの適切な指示に従って正しく並べて表示しましたが、ソース画像は垂直方向にかなり引き伸ばされています。ビットマップファイルタイプの性質に関係していると思います。
例の写真:
最初の画像はタイリング前の背景画像です。2枚目の画像は貼り付け後です。ご覧のとおり、画像は縦方向にかなり引き伸ばされており、サイズ変更により少しぼやけて見えます。
drawable-hdpi と drawable フォルダーの両方に画像を配置してみました。XML ファイルを両方のフォルダーに配置しようとしました。それはどれも問題ではないようでした。
これら 2 つの画像を生成したレイアウトのコードは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/bg" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:background="@drawable/bg_repeat" />
</LinearLayout>
「@drawable/bg」は実際の画像そのもの、bg.pngです。「@drawable/bg_repeat」は、次のビットマップ XML ファイルです。
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/cdetail_bg_unclaimed_details"
android:antialias="false"
android:dither="false"
android:filter="false"
android:gravity="center|center_vertical"
android:tileMode="repeat" />
x-repeat タイリングにこれに代わるものはありますか? それとも、まだ調べていない回避策がありますか? アンチエイリアス、ディザ、フィルターなどのすべてのオプションを変更しましたが、何も変わっていないようです。
助けてくれてありがとう!
編集: これは、グラフィカル レイアウト ツールを使用したバグのようです。私の電話では問題ないようです。