Android ListView元素間隙線自定義漸變效果
首先創建一個簡單的ListView,并設置對應的屬性
<ListView
android:id="@+id/artistsNameView"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:divider="@drawable/jblineshape"
android:dividerHeight="1sp">
</ListView></pre>
注意其中兩句:對應的就是設置ListView中的Item之間的間隙線的,使用的一個XML文件:jblineshape.xml(實現的是漸變線的效果)
--->> android:divider="@drawable/jblineshape"
--->> android:dividerHeight="1sp"</pre>
配置文件: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></pre>
效果圖:

本文由用戶 fmms 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!