Can anyone please help me in understanding drawableStateChanged() method of toggle button in android?

自闭症网瘾萝莉.ら 提交于 2021-02-10 16:20:58

问题


Can anyone please help me in understanding drawableStateChanged method of toggle button in android??? I wanted to know why exactly it is used for and how to implement it?? I found it on following link: http://developer.android.com/reference/android/widget/ToggleButton.html.


回答1:


from reading through the documentation which states:

This function is called whenever the state of the view changes in 
such a way that it impacts the state of drawables being shown.

it seems that this function will be called by the framework whenever the component needs to be redrawn and you can override it to (for example) perform so application specific logic which you need to do when the component is redrawn, like manually drawing something over the top of the component, or changing the font or doing something which is not possible using the stock attributes.

This question has an example of how you might implement it.



来源:https://stackoverflow.com/questions/20933094/can-anyone-please-help-me-in-understanding-drawablestatechanged-method-of-togg

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