【发布时间】:2015-12-18 09:49:37
【问题描述】:
我必须为许多不同颜色的视图设置背景。但是如果我这样做,xml将是大约20个文件,这是巨大的,所以我想将以下xmllayer-list转换为完全独立的模块,甚至没有一个xml,这样它就可以重复使用,请帮帮我。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
//i can create this drawable
<item>
<shape android:shape="rectangle">
<solid android:color="#ff2632"/>
</shape> </item>
//I don't know how to achieve this one, especially this "bottom property"
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="#d7ffa2"/>
</shape> </item>
</layer-list>
【问题讨论】:
-
你想换什么颜色?
-
@NigamPatro,
-
@NigamPatro,基本上我必须将此 xml 设置为背景,以便可以使用不同颜色代码的视图
-
意思是,底部?
标签: android android-drawable layer-list android-shape android-shapedrawable