There is the following method:
@Override
public void mark() {
ImageView image=(ImageView)view.findViewById(R.id.listItemRepeatingTypeImage);
image.setBackgroundColor(Color.RED);
image.invalidate();
Log.e("event", "mark");
view.setBackgroundColor(Color.GREEN);
view.invalidate();
}
As you can see, I try to change background color for View and ImageView (view is an item of ListView). This event becomes, but there is no new background. How can I fix it?
Try to apply this style to your ListView:
<style name="List">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:background">#FFFFFF</item>
<item name="android:dividerHeight">1dp</item>
<item name="android:divider">#CCCCCC</item>
<item name="android:cacheColorHint">#FFFFFF</item>
<item name="android:listSelector">#00000000</item>
</style>
And in your xml layout this:
<ListView
android:id="@+id/listView"
style="@style/List"
android:paddingTop="1dp"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.