创建可绘制的形状 [英] Create shape for drawable
本文介绍了创建可绘制的形状的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有ListView
,并且我有列表项的背景:
I have ListView
, and i have a background for the list items:
有什么方法可以将背景作为shape
重新创建为drawable
XML?最外面的灰色不是项目背景的一部分,实际上是ListView
.
Is there any way to recreate this background as a shape
in drawable
XML? The most outer grey is not part of the item background, it is actually the ListView
.
推荐答案
您可以尝试使用自己选择的值.它将使底部的两个角变圆.
You can try following with the values of your choice. It will make the bottom two corners rounded.
rounded_rectangle.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient android:angle="270" android:endColor="#404040" android:startColor="#404040" />
<stroke android:width="1dp" android:color="#808080" />
<corners android:bottomLeftRadius="11dp" android:bottomRightRadius="11dp"/>
</shape>
</item>
</selector>
然后按如下所示将其用作列表项的背景
then use it as a background to your listitem as follows
android:background="@drawable/rounded_rectangle"
这篇关于创建可绘制的形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文