布局文件
android
<ListView android:layout_width="match_parent" android:layout_height="wrap_content" android:divider="#f00" android:entries="@array/books" android:dividerHeight="2px" android:headerDividersEnabled="false" >
上面的布局文件定义了一个ListView,并经过android:entries制定了列表数组,经过android:divider改变了列表项之间的分隔条。数组
2. 数组定义以下:ide
<?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="books"> <item>hello world</item> <item>hello world hello world </item> <item>hello world hello world hello world </item> <item>hello world hello world hello world hello world </item> <item>hello world hello world hello world hello world hello world </item> </string-array> </resources>
数组里面定义的item会一一显示出来。布局