Skip to content Skip to sidebar Skip to footer

Theme Style For Custom View

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 custom

Solution 1:

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:

<stylename="LilaTheme"parent="Theme.AppCompat.Light.NoActionBar"><itemname="buttonStyle">@style/ButtonmyTimeLila</item></style>

Post a Comment for "Theme Style For Custom View"