`
libo19881179
  • 浏览: 266064 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ListView item渐变背景(ListView必备!)

阅读更多

在看他人的代码学习时,无意中发现的。很多应用中的ListView每个item的背景都是白色渐变的,感觉很有立体感.

之前我一直以为是一张美工提供的背景图,今天终于明白了,其实是可以在xml中定义出这种效果的!


先看看效果!

纯白色背景:



 

渐变:


模拟器的效果不如真机好,不过你可以根据自己需求跳转渐变范围~ 




<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:startColor="#ffffff"
        android:endColor="#EDEDED"
        android:angle="-90" />
</shape>


 和图片一样 放入drawable  配置好把它看成图片调用就好了~

控件xml中 调用 android:background="@drawable/pull_to_refresh_header_background" 是不是很简单 ~

  • 大小: 58.3 KB
  • 大小: 56 KB
分享到:
评论
6 楼 libo19881179 2011-11-21  
wdaming_1986 写道
 

谢啦~
5 楼 wdaming_1986 2011-11-21  
 
4 楼 sunchaohui_koko 2011-11-13  
http://xdoc.iteye.com/admin/blogs/1180961
3 楼 sunchaohui_koko 2011-11-13  
http://xdoc.iteye.com/admin/blogs/1180961
2 楼 libo19881179 2011-11-08  
zhongxinhu 写道
请问为什么要搞2层
<SPAN style="FONT-SIZE: small">
<SPAN style="FONT-SIZE: small">

没注意,应该是写重复了
1 楼 zhongxinhu 2011-11-08  
请问为什么要搞2层
<SPAN style="FONT-SIZE: small">
<SPAN style="FONT-SIZE: small">

相关推荐

Global site tag (gtag.js) - Google Analytics