http://blog.csdn.net/way_ping_li/article/details/8037558


ListView中每个Item项之间都有分割线,设置android:footerDividersEnabled表示是否显示分割线,此属性默认为true。

1.不显示分割线只要在ListView控件中添加android:footerDividersEnabled="false"即可。

[html]  view plain copy
  1. <ListView  
  2.     android:id="@+id/local_groups_list"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="wrap_content"  
  5.     android:footerDividersEnabled="false" />  


 

2.改变ListView的分割线颜色和宽度,需要在布局中定义android:dividerandroid:dividerHeight属性。

[html]  view plain copy
  1. <ListView  
  2.     android:id="@+id/local_groups_list"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="wrap_content"  
  5.     android:divider="@color/divider_color"  
  6.     android:dividerHeight="1px" />  

调整ListView分割线

主要用以下2个属性来调整

android:divider="@drawable/line" 可以是图片可以是颜色

android:dividerHeight="3px"  数量单位

调整ListView行高

主要是调整adapter包含的layout的行高


main_list代码是:


[java]  view plain copy
  1. SimpleAdapter adapter = new SimpleAdapter(this,getData(),R.layout.main_list,  
  2.   
  3. new String[]{"img""info"},  

main_list.xml代码是:

[html]  view plain copy
  1. <?xml version="1.0" encoding="utf-8"?>  
  2.   
  3. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  4.   
  5.     android:orientation="horizontal"   
  6.   
  7.     android:layout_width="fill_parent"  
  8.   
  9.     android:layout_height="70dip"  
  10.   
  11.     android:gravity="center"  
  12.   
  13.     >  
  14.   
  15.     <ImageView android:id="@+id/img"  
  16.   
  17.         android:layout_width="wrap_content"  
  18.   
  19.         android:layout_height="wrap_content"  
  20.   
  21.         android:paddingTop="5px"  
  22.   
  23.         android:paddingBottom="5px"  
  24.   
  25.         />  
  26.   
  27.    
  28.   
  29.     <TextView android:id="@+id/info"  
  30.   
  31.      android:layout_width="wrap_content"  
  32.   
  33.         android:layout_height="wrap_content"  
  34.   
  35.         android:textSize="20sp"  
  36.   
  37.      />  
  38.   
  39. LinearLayout>  

更多相关文章

  1. android代码实现关机
  2. android 中的 edittext属性大全
  3. Android学习笔记:androidmanifest.xml 高级属性
  4. 关于android:configChanges的属性
  5. LinearLayout && RelativeLayout 常用属性
  6. android 查询工具源代码
  7. Android中自定义属性(attrs.xml,TypedArray的使用)
  8. android 属性系统 及其 补充

随机推荐

  1. Android Unable to resolve target 'andr
  2. 关于Android(安卓)Https网络连接失败奇葩
  3. Android(安卓)计算两个地理坐标之间的距
  4. Android Q : 安卓源码、水滴屏适配状态栏
  5. Android 中文 API (21) ―― DigitalClock
  6. Android 教你如何通过 LocationManager
  7. android中实现从一个图片中截取一部分,在
  8. android layout属性 .
  9. Android模仿文件夹管理实例
  10. Android画图学习笔记一 类的简介