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的CheckBox控件的点击效果布局文件
  3. Android中自定义属性(attrs.xml,TypedArray的使用)
  4. LinearLayout && RelativeLayout 常用属性
  5. 关于android:configChanges的属性
  6. android圆角、边框、画线效果、RatingBar背景
  7. android 中的 edittext属性大全
  8. Android学习笔记:androidmanifest.xml 高级属性
  9. android 拨号盘Contact模块讲解(四)

随机推荐

  1. Android沉浸式状态栏实现示例
  2. 关于Android程序入口的猜想
  3. App工程结构搭建:几种常见Android代码架构
  4. Android之UI线程与子线程交互设计的5种方
  5. System Permissions --1.4
  6. android连接小票打印机,打印小票数据的两
  7. SVG和Vector的概念和如何在Android(安卓)
  8. 2.android中使用锁来兼容netty客户端的写
  9. android 是怎样画视图的
  10. 美食家App开发日记1