Android, updating view in realtime overlapping old

2019-08-10 20:07发布

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条回答
做自己的国王
2楼-- · 2019-08-10 20:19

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>
查看更多
登录 后发表回答