Android的图像背景重复
问题描述:
我有用于的LinearLayout背景 一个形象比方说像有20X100 PX 我想要只在X轴的图像重复......像这样的东西在CSSAndroid的图像背景重复
background-repeat:repeat-x;
该LinearLayout中是有点大(1024×680像素),所以我的形象将覆盖整个宽度,但仅在顶部(580像素高度的其余部分将是透明的) 我希望我是清楚的 感谢
答
尝试使用android:tileMode
在绘制文件夹中创建background.xml
为:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg"
android:tileMode="repeat" />
,然后用它在你的布局XML为:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
做ü知道draw9patch图像? – 2012-02-14 14:56:34