开发者

Creating an Android indicator light

开发者 https://www.devze.com 2023-03-11 23:52 出处:网络
I\'m looking for an easy way to create an indicator light that I can toggle on and off.Ra开发者_高级运维diobuttons seem great for this, they even look like lights, but you can\'t toggle them off.Is th

I'm looking for an easy way to create an indicator light that I can toggle on and off. Ra开发者_高级运维diobuttons seem great for this, they even look like lights, but you can't toggle them off. Is there an easy way to modify them so that they can be toggled off? Or is there an even simpler solution?

(I'd rather not use the toggle button, I need a round light)


You could try using a RadioButton and override the onClick(...) method to simply toggle the checked state yourself with...

myRadioButton.setChecked(!myRadioButton.isChecked());


I'd suggest that you subclass an image view and toggle the image and state yourself.

0

精彩评论

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