Android开发----ListView去掉默认分割线 并且加上圆角

来源:互联网 发布:翟欣欣 马蓉 知乎 编辑:程序博客网 时间:2024/06/16 12:45


1.divider设置为@null

[html] view plain copy
  1. <ExpandableListView  
  2.     android:id="@+id/lv_content"  
  3.     android:layout_width="match_parent"  
  4.     <span style="background-color: rgb(204, 0, 0);">android:divider="@null"</span>  
  5.     android:layout_height="match_parent" >  
  6. </ExpandableListView>  
2.divider设置颜色#00000000

[html] view plain copy
  1. <ExpandableListView  
  2.     android:id="@+id/lv_content"  
  3.     android:layout_width="match_parent"  
  4.     <span style="background-color: rgb(204, 0, 0);">android:divider="#00000000"</span>  
  5.     android:layout_height="match_parent" >  
  6. </ExpandableListView>  



3.设置圆角的办法

   

在drawable目录下添加borad_radio.xml,设置控件的边框代码。如下:

<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" >    <solid android:color="#CE0000"/>    <corners        android:radius="6dp" /></shape>

调用样式只要设置控件的android:background="@drawable/border_radio"  即可

效果如下图




    原创粉丝点击