最近由于需要开发一个基于android系统的小查询系统,直接从代码里面学习是最快的,确实通过三天的努力,系统完成了,中间走了不少弯路,但是起码东西是做出来了,有很多代码都是从这个论坛里下的,也没有什么回报的,只能上传一些学习过程中的代码了。
1.在如何使用ListView控件,有一篇文章(android ListView详解)给了我很大的帮助,我就不重新在这里再打一遍了,直接发网址:
http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html
2.该代码的效果图1如下:
main.xml的代码如下:
复制代码
list_item.xml的代码如下:
复制代码
selector的代码如下:
复制代码
对于只修改一个其中的几个颜色就能实现各种不同的listview风格,肯定比处理图片轻松多了
4.有兴趣可以下载看看:
CustomList.rar(691.73 KB, 下载次数: 524)
1.在如何使用ListView控件,有一篇文章(android ListView详解)给了我很大的帮助,我就不重新在这里再打一遍了,直接发网址:
http://www.cnblogs.com/allin/archive/2010/05/11/1732200.html
2.该代码的效果图1如下:
![094441fyvzjqp6odhdyz6v.bmp 094441fyvzjqp6odhdyz6v.bmp](http://www.apkbus.com/data/attachment/forum/201205/14/173624riinr22ni99a5ixr.bmp)
main.xml的代码如下:
- <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#253853"
- >
- <listview android:id="@+id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginBottom="10dp"
- android:cacheColorHint="#00000000"
- android:divider="#2A4562"
- android:dividerHeight="4px"
- android:listSelector="#264365"
- android:drawSelectorOnTop="false"
- >
-
-
- <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="@drawable/selector"
- >
-
- <imageview android:id="@+id/img"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_marginLeft="20dp"
- />
-
- <linearlayout android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content">
-
- <textview android:text="data" android:id="@+id/title"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:gravity="center_vertical"
- android:layout_marginLeft="20dp"
- android:layout_marginTop="20dp"
- android:textSize="14sp"
- android:textStyle="bold"
- android:textColor="@color/black"
- >
-
-
-
-
- <gradient android:angle="270" android:endcolor="#99BD4C"
- android:startColor="#A5D245" />
- <padding android:left="15dp" android:top="20dp"
- android:right="15dp" android:bottom="20dp" />
-
-
-
-
-
-
- <gradient android:angle="270" android:endcolor="#99BD4C"
- android:startColor="#A5D245" />
- <padding android:left="15dp" android:top="20dp"
- android:right="15dp" android:bottom="20dp" />
-
-
-
-
-
-
- <gradient android:angle="270" android:endcolor="#A8C3B0"
- android:startColor="#C6CFCE" />
- <padding android:left="15dp" android:top="20dp"
- android:right="15dp" android:bottom="20dp" />
-
-
-
-
4.有兴趣可以下载看看:
![](http://www.apkbus.com/static/image/filetype/rar.gif)
![23025113q3r45oqrrrgg1r.bmp 23025113q3r45oqrrrgg1r.bmp](http://www.apkbus.com/data/attachment/forum/201205/14/174304pt46he6r3331hd43.bmp)