2013-12-23 62 views
0

我必须使用图层列表创建以下图像。使用图层列表创建绘图

注意:假设中间的阴天图标可用。 如此卑劣: 1.如何绘制红色背景的盒子。 2. 1dp黑色边框。 3.将rectengle enter image description here

+0

在其布局ü要作出这个。豪宅吧。 –

回答

1

布局XML中间的可用图像:

<View android:layout_width="200dp" 
    android:layout_height="100dp" 
    android:background="@drawable/my_drawable" /> 

绘制对象的xml:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
<item> 
    <shape android:shape="rectangle"> 
     <stroke android:width="1dp" android:color="#000000"/> 
     <solid android:color="#FF0000"/> 
    </shape> 
</item> 
<item> 
    <bitmap android:gravity="center" android:src="@drawable/icon"/> 
</item> 
</layer-list> 
+0

+1,谢谢。这有帮助。 – reiley