ToggleButton.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:EveryXDay 作者:
public void setup(AttributeSet attrs) {
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Style.FILL);
    paint.setStrokeCap(Cap.ROUND);

    springSystem = SpringSystem.create();
    spring = springSystem.createSpring();
    spring.setSpringConfig(SpringConfig.fromOrigamiTensionAndFriction(50, 7));

    this.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            toggle();
        }
    });

    TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.ToggleButton);
    offBorderColor = typedArray.getColor(R.styleable.ToggleButton_offBorderColor, offBorderColor);
    onColor = typedArray.getColor(R.styleable.ToggleButton_onColor, onColor);
    spotColor = typedArray.getColor(R.styleable.ToggleButton_spotColor, spotColor);
    offColor = typedArray.getColor(R.styleable.ToggleButton_offColor, offColor);
    borderWidth = typedArray.getDimensionPixelSize(R.styleable.ToggleButton_borderWidth, borderWidth);
    typedArray.recycle();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号