tin*_*nti 13 android background-image repeat
我有一个用于LinearLayout背景的图像让我们说图像有20x100像素我想让图像只在x轴上重复...在css中这样的东西
background-repeat:repeat-x;
Run Code Online (Sandbox Code Playgroud)
LinearLayout有点大(1024 x 680像素),所以我的图像将覆盖整个宽度,但只在顶部(其余580像素的高度将是透明的)我希望我很清楚谢谢
Zeb*_*eba 55
尝试使用android:tileMode
background.xml在drawable文件夹中创建:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg"
android:tileMode="repeat" />
Run Code Online (Sandbox Code Playgroud)
然后在你的布局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" >
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25908 次 |
| 最近记录: |