您的位置:首页 > 其它

改变分隔条,基于数组的ListView

2016-05-28 16:18 197 查看
布局文件<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.  数组定义如下:<?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会一一显示出来。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: