SyB*_*Ber 7 android listview drawable divider
是否可以为ListView分隔符绘制两个笔画(一个接一个)?
我尝试过以下drawable,但它只显示第一个笔划:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#eeeeee"
/>
<size
android:height="1px"
/>
<stroke
android:color="#c1c1c1"
/>
<size
android:height="1px"
/>
</shape>
Run Code Online (Sandbox Code Playgroud)
Tom*_*mik 21
对的,这是可能的.如果您想使用shape drawable创建它,则必须采用不同的方式.可绘制的形状只能包含一个形状,在您的情况下可以包含一条线.您可以在图层列表drawable中组合两个形状.图层列表中的Drawable是一个在另一个上面绘制的,最后一个在顶部.要创建两条线,您只需为每条线设置正确的填充,以便两条线都可见.得到的drawable将是这样的(我在示例中使线条更粗):
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:bottom="2dp">
<shape android:shape="line">
<stroke
android:color="#eeeeee"
android:width="2dp"
/>
<size
android:height="4dp"
/>
</shape>
</item>
<item android:top="2dp">
<shape android:shape="line">
<stroke
android:color="#c1c1c1"
android:width="2dp"
/>
<size
android:height="4dp"
/>
</shape>
</item>
</layer-list>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7806 次 |
| 最近记录: |