我想在我的RelativeLayout中有一个重复的图案作为背景。
<RelativeLayout
android:layout_width="0dp"
android:layout_height="600dp"
android:layout_weight=".20"
android:background="@drawable/timetable_background"
android:tileMode="repeat" >
但是tileMode不起作用并且只显示一次运行。 这是我的模式:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:bottom="50dp" android:height="50dp">
<shape android:shape="rectangle" >
<solid android:color="@color/timetableEntryBackground1" />
</shape>
</item>
<item android:top="50dp" android:height="50dp">
<shape android:shape="rectangle" >
<solid android:color="@color/timetableEntryBackground2" />
</shape>
</item>
</layer-list>
我需要改变什么,背景会重复?
最佳答案
您应该在layer-list
的项目中使用tileMode
,如下所示:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:bottom="50dp" android:height="50dp">
<shape android:shape="rectangle" >
<solid
android:color="@color/timetableEntryBackground1"
android:tileMode="repeat" />
</shape>
</item>
...
</layer-list>
关于java - 重复图层列表中的颜色背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46835470/