我有一个ListView:
<ListView
android:id="@+id/mainList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="1dip"
android:layout_marginRight="1dip"
android:divider="@drawable/list_divider"
android:dividerHeight="1px"
android:textAppearance="?android:attr/textAppearanceSmall"
android:cacheColorHint="#00000000"
/>和list_divider.xml中的形状
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#00000000"
android:centerColor="#FFFFFFFF"
android:endColor="#00000000"
android:angle="0" />
</shape>但是没有像这样的分隔器:白色灰色-黑色-灰色-白色
我明白了:白-灰-黑-灰-白-黑-灰-白??
简而言之,分隔器被分成两个相似的部分,我只需要一个。
发布于 2013-11-29 14:30:46
用于渐变白色-灰色-黑色-灰色-白色用途:
<gradient
android:startColor="#ffffff"
android:centerColor="#000000"
android:endColor="#ffffff"
android:angle="0">双渐变可能是由于你添加到你的颜色的阿尔法通道。例如,中心颜色以#00 (8字节)开始,意味着完全透明,因此您有底层颜色。
发布于 2018-07-31 13:20:08
我稍微改变了梯度。可能对某些人有用。
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="#E4E4E4"
android:centerColor="#F0F0F0"
android:endColor="#E4E4E4"
android:angle="90" />
</shape>https://stackoverflow.com/questions/20284131
复制相似问题