开发者

custom button: properties change, button should be redrawn

I'm developing an Android app.

I have class derived from button to represent a special type of button. This special type has some properties (integers) and according to these one or more circles have to be drawn on top of the button.

So I overrode the onDraw function, which looks the values up and accordingly draws the circles.

But the class has a function to set new values for its properties. So new values are set but the changes are not reflected in the UI. It seems like the onDraw function is not called.

When later I click the button or show a p开发者_开发知识库op up message above my interface the onDraw function is called and the button is drawn correctly.

So my question: when changing the properties how can I say that the button has to be redrawn?

Thanks a lot!


Call invalidate() on the button to have it (or part of it) redrawn.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜