展会信息港展会大全

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

导读:首先创建一个简单的ListView,并设置对应的属性1ListView2android:id=@+id/artistsNameView3android:layout_width=fill_parent4android:layout_height=match_parent5android:divider=@drawable/jblinesh......

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

1

<ListView

2

android:id="@+id/artistsNameView"

3

android:layout_width="fill_parent"

4

android:layout_height="match_parent"

5

android:divider="@drawable/jblineshape"

6

android:dividerHeight="1sp">

7

</ListView>

1

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

2

3

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

4

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

01

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

02

03

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

04

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

05

<gradient

06

android:startColor="#00000000"

07

android:centerColor="#FFFFFF"

08

android:endColor="#00000000"

09

/>

10

<corners

11

android:radius="4dp"

12

/>

13

14

</shape>

效果图:

赞助本站

人工智能实验室

相关热词: 渐变

相关内容
AiLab云推荐
展开

热门栏目HotCates

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