简体   繁体   English

Android Listview ArrayAdapter示例

[英]Android Listview ArrayAdapter example

I am using custom row view in ListView widget. 我在ListView小部件中使用自定义行视图。

I am having getView method in my implementation. 我的实现中有getView方法。

What I want is that I want to hide divider image of 2nd row how can I do it? 我想要的是我想隐藏第二行的分隔线图像,我该怎么办?

If you're talking about the image that displays when you call setDivider, or android:divider in XML, I don't think you can hide it on some rows and show it on other rows. 如果您要谈论的是在XML中调用setDivider或android:divider时显示的图像,我认为您无法将其隐藏在某些行上并在其他行上显示。

Instead, you can create a PNG (probably with draw9patch) with a border on the top or the bottom, and in your ListAdapter.getView() set it as the background on whatever rows you want. 相反,您可以创建一个PNG(可能带有draw9patch),该PNG的顶部或底部带有边框,并在ListAdapter.getView()中将其设置为所需行上的背景。 On the other rows, you can set a background that has no border. 在其他行上,您可以设置没有边框的背景。 This will give the appearance that some rows have a divider, and others don't. 这将使某些行具有分隔符,而其他行则没有分隔符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM