【发布时间】:2013-11-25 14:45:30
【问题描述】:
我正在尝试从图像文件制作背景。
我的 background.xml 文件是这样的:
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg_pat_100_100"
android:tileMode="repeat"
android:dither="true"
/>
我在我的布局中使用这个背景,像这样:
<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=".XYZ"
android:background="@drawable/background"
>
<!-- ... layout content ... -->
</RelativeLayout>
现在,如果我在仿真器设备中运行它,它会使背景重复,正如预期的那样。
但如果我在真实设备上运行它,背景就像一个单一的图像,在整个屏幕上拉伸。
可能是什么问题?
附言
我尝试删除应用程序,清除 eclipse 项目,删除 R.java。他们都没有改变这种情况。
【问题讨论】:
-
如果我的回答对您有所帮助,请将其设置为正确,因为它会对我有所帮助。谢谢。
标签: android xml background repeat tile