By xml,you can search by google.I will show you one way to solve the problem. A forum which mentioned this problem
Of course,if you don't use xml,you must change this to java code.It's simple,but this means it won't show complex effects.
Supplement:Override the onStateChange method,you should override your widget.