我试图让背景上的图像平铺,直到背景已满。
我目前的代码是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/cartoonclouds"
android:contentDescription="@string/desc"
android:tileMode="repeat" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</LinearLayout>
</RelativeLayout>
然而,这只会使图像覆盖(不平铺)从下到上,而不是从左到右。我应该做什么?
编辑:尝试了 XML 版本:
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:tileMode="repeat"
android:src="@drawable/cartoonclouds" />
main.xml 可以在与该 XML 文件相同的文件夹中找到 cartoonclouds,但找不到该 XML 文件。