android: onDraw is called constantly

前端 未结 2 398
野性不改
野性不改 2021-01-21 11:50

I have a problem with a custom button. onDraw() gets called again and again, and I can\'t figure out why.

public class CircleButton extends Button {

    static          


        
2条回答
  •  既然无缘
    2021-01-21 12:15

    Change the drawableStateChanged() method:

    1. Don't call invalidate
    2. Call super.drawableStateChanged().

提交回复
热议问题