ListView拖動時,背景顏色會變成黑色
通過查找API 文檔找到這個函數
public void setCacheColorHint (int color)
Since: API Level 1When set to a non-zero value, the cache color hint indicates that this list is always drawn on top of a solid, single-color, opaque background. Zero means that what's behind this object is translucent 透明的 (non solid) or is not made of a single color. This hint will not affect any existing background drawable set on this view ( typically set via setBackgroundDrawable(Drawable)).
Parameters
color The background color
所以我將這個顏色設置為全0即可
解決方法1:
是在ListView xml文件中加入以下屬性即可:
Android:cacheColorHint="#00000000"
解決方法2:
代碼中寫明listview.setCacheColorHint(0);這樣就不會出現這種情況了。
更多Android相關信息見Android 專題頁面 http://www.linuxidc.com/topicnews.aspx?tid=11