[英]Android ListView : bad gradient divider
我有一個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>
但不是像這樣的分隔物:白色 - 灰色 - 黑色 - 灰色 - 白色
我明白了:白色 - 灰色 - 黑色 - 灰色 - 白色 - 灰色 - 黑色 - 灰色 - 白色???
簡而言之,分隔器被分成兩個相似的部分,我只需要一個。
對於漸變白灰黑色 - 灰白色使用:
<gradient
android:startColor="#ffffff"
android:centerColor="#000000"
android:endColor="#ffffff"
android:angle="0">
雙梯度可能是由於您添加到顏色的Alpha通道。 例如,中心顏色以#00 (8字節)開頭,表示完全透明,因此您具有底層顏色。
我稍微改變了漸變。 對某些人來說可能有用。
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.