展会信息港展会大全

Android ListView元素间隙线自定义渐变效果
来源:互联网   发布日期:2015-11-26 09:33:12   浏览:917次  

导读:首先创建一个简单的ListView,并设置对应的属性ListView android:id=@+id/artistsNameView android:layout_width=fill_parent android:layout_height=match_parent ......

首先创建一个简单的ListView,并设置对应的属性

<ListView

android:id="@+id/artistsNameView"

android:layout_width="fill_parent"

android:layout_height="match_parent"

android:divider="@drawable/jblineshape"

android:dividerHeight="1sp">

</ListView>

注意其中两句:对应的就是设置ListView中的Item之间的间隙线的,使用的一个XML文件:jblineshape.xml(实现的是渐变线的效果)

--->> android:divider="@drawable/jblineshape"

--->> android:dividerHeight="1sp"

配置文件:jblineshape.xml,为渐变效果的,透明->白色->透明(可根据自己需要进行设置)

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<gradient

android:startColor="#00000000"

android:centerColor="#FFFFFF"

android:endColor="#00000000"

/>

<corners

android:radius="4dp"

/>

</shape>

效果图:

\

赞助本站

人工智能实验室

相关热词: 渐变效果

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港