Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 aListActivity和ArrayAdapter. 我有一个Strings 数组,我想String在列表中的第 5 个之后放置一个分隔符。有没有办法做到这一点?抱歉,如果有重复,只是没有找到我要找的东西。提前致谢。
ListActivity
ArrayAdapter
String
有一个黑客。
最后在你的 list_item 的布局文件中添加一个分隔视图并给它一个 ID。现在在您的自定义适配器类中,您可以在 getView() 方法中根据您是否希望显示该视图的位置来设置该视图的可见性。
Listview 的一个属性将帮助您:
android:divider = (color or drawable)
并且
android:dividerHeight = (integer in dp)