Android, updating view in realtime overlapping old view

我与影子孤独终老i 提交于 2019-12-11 12:42:17

问题


I'm having an issue when trying to update a progress bar. When I update the progress bar, its as if the updated view draws over the current view. Even when I'm getting the view by ID. I would of assumed that it is updating the current view so whats currently there should be discarded. Changing progress from 80 to 30 to 25 for example turns out like below:

http://i.stack.imgur.com/UnUvA.png

The below is called numerous times. the cursor.getInt(4) will return different values based on what the user does.

My phone is running android 2.3.7

ProgressBar bar = (ProgressBar) findViewById(R.id.progressbar);
int rating = cursor.getInt(4);
bar.setProgress(rating);

回答1:


The issue was that there was a theme set up with the attribute @null as the windowBackground.

This meant that the background wasn't redrawn so updated items appeared to be drawn over current items.

<item name="android:windowBackground">@null</item>


来源:https://stackoverflow.com/questions/10106490/android-updating-view-in-realtime-overlapping-old-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!