Theme style for custom view

后端 未结 1 418
执笔经年
执笔经年 2020-12-21 03:35

My app has several themes from which the user can chose (red, blue, green etc.) Every theme has a corresponding button style (RedTheme => RedButton). Now I have created a cu

1条回答
  •  情歌与酒
    2020-12-21 04:16

    I'm using the three parameter super constructor and pass the button style resource id. This works for all my custom themes. Thanks @pskink for pointing me into right direction.

    public ClockButton(Context context, AttributeSet attrs) {
        super(context, attrs, R.attr.buttonStyle);
        ...
    }
    

    My theme looks like this:

    
    

    0 讨论(0)
提交回复
热议问题