我有一个Android的ListView自定义单元格。该自定义单元格是里面的一些观点相对布局。还有每个单元之间的空间,所以我想添加到细胞阴影的底部。
I have a custom cell for an Android ListView. This custom cell is a relative layout with some views inside. There is a space between each cell, so I want to add to the bottom of the cells a shadow.
我一直在谷歌上搜索周围,但未能发现什么了吗?我要实现类似这样:
I've been googling around but couldn't found anything? I want to achieve something similar to this:
谢谢!
推荐答案
可以在下面两种方式完成的:
Can be done in below two ways:
9,补片图像 - 点击链接理解9补丁使用图层列表 - 创建的RES /绘制,其中包含新的文件: 9-patch images - click link for understanding 9 patch
Using layer-list - Create new file in "res/drawable" which contains:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<shape
android:shape="rectangle">
<solid android:color="@android:color/darker_gray" />
<corners android:radius="5dp"/>
</shape>
</item>
<item android:right="1dp" android:left="1dp" android:bottom="2dp">
<shape
android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="5dp"/>
</shape>
</item>
</layer-list>
然后在你的列表项目布局(即,LinearLayout中或等)添加到该层次列表文件作为背景。
Then add this layer-list file as background in your List item Layout(ie., Linearlayout or etc..).
相关推荐
最新文章