首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android ListView :坏的梯度除法器

Android ListView :坏的梯度除法器
EN

Stack Overflow用户
提问于 2013-11-29 10:57:32
回答 2查看 1.4K关注 0票数 0

我有一个ListView:

代码语言:javascript
复制
<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中的形状

代码语言:javascript
复制
<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>

但是没有像这样的分隔器:白色灰色-黑色-灰色-白色

我明白了:白-灰-黑-灰-白-黑-灰-白??

简而言之,分隔器被分成两个相似的部分,我只需要一个。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-11-29 14:30:46

用于渐变白色-灰色-黑色-灰色-白色用途:

代码语言:javascript
复制
<gradient
   android:startColor="#ffffff"
   android:centerColor="#000000"
   android:endColor="#ffffff"
   android:angle="0">

双渐变可能是由于你添加到你的颜色的阿尔法通道。例如,中心颜色以#00 (8字节)开始,意味着完全透明,因此您有底层颜色。

票数 2
EN

Stack Overflow用户

发布于 2018-07-31 13:20:08

我稍微改变了梯度。可能对某些人有用。

代码语言:javascript
复制
<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>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20284131

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档