Set a theme programmatically on Android 5.0 Lollipop
android: a theme modifies certain attributes specified in the theme resource. You can create a specific view using any overloaded constructor, eg View(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
. this is basically what the inflator does.
For example, v7.widget.Toolbar
trying to create a thematic context from a resource android:theme
right in the constructor supercall, which is more or less what I mentioned above. Only certain widgets override the app theme using android:theme
.
I am not sure if it is possible to specify the topic directly and not the instance mentioned above, or use a supported custom attribute and associated method.
source to share