最近在做工作流的项目,项目开发中需要把项目的明细用表格的样式展示在ListView控件上,前前后后测试了几个demo运用到项目中,感觉相当佩服他们,所以也尝试着学习他们自己制作了一个demo,就当自娱自乐,仅供参考。你们也可以参考以下博客:
http://blog.youkuaiyun.com/bewhatyouare/article/details/8373584
http://www.diannao.wang/anzhuo/2015/52-81030.html
项目中由于单条信息过长,一个屏幕不可能完全展示出来,所以用到了HorizontalScrollView控件,此控件可以实现屏幕的横向滚动。
项目开发中ListView适配器的布局界面list_item.xml如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="horizontal" >
<TextView
android:id="@+id/name"
style="@style/itemStyle"
android:layout_width="140dp" />
<View
style="@style/viewStyle"
android:visibility="visible" />
<TextView
android:id="@+id/age"
style="@style/itemStyle"
android:layout_width="70dp" />
<View
style="@style/viewStyle"
android:visibility="visible" />
<TextView
android:id="@+id/height"
style="@style/itemStyle"
android:layout_width="55dp" />
<View
style="@style/viewStyle"
android:visibility="visible" />
<TextView
android:id="@+id/weight"
style="@style/itemStyle"
android:layout_width="150dp" />
<View
style="@style/viewStyle"
android:visibility="visible" />
<TextView
android:id="@+id/school"
style="@style/itemStyle"
android:layout_width="150dp" />
</LinearLayout>
Activity用到的布局界面activity_main.xml如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff