简体   繁体   English

Android ListView不会在滚动上重新绘制

[英]Android ListView not being repainted on scroll

This is best described with pictures. 最好用图片来描述。 Before scrolling in my ListView , everything looks fine: 在滚动ListView之前,一切看起来都很好:

在此处输入图片说明

After scrolling: 滚动后:

在此处输入图片说明

What could be causing this odd behavior? 是什么导致这种奇怪的行为? I am testing it on a Google Nexus running Android 4.2.2 and have tried it on the emulator running Android 3.2 with the same result. 我正在运行Android 4.2.2Google Nexus上进行测试,并在运行Android 3.2的模拟器上进行了尝试,结果相同。 In this example I am using a ListView with two types of rows, but I get the same result with a standard ListView with just one row type. 在此示例中,我将使用具有两种类型的行的ListView ,但是对于仅具有一种行类型的标准ListView ,我将获得相同的结果。

It turns out the problem was that I did not set a background color in my layout XML file... If someone could explain to me why this fixes the problem, I would greatly appreciate it. 事实证明,问题是我没有在布局XML文件中设置背景颜色...如果有人可以向我解释为什么这可以解决问题,我将不胜感激。 Adding android:background="#000000" to my main layout fixed it, though. 不过,将android:background =“#000000”添加到我的主布局中可以解决此问题。

.... ....

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

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