Set a theme on a View programmatically on Android 5.0 Lollipop

感情迁移 提交于 2019-12-04 11:40:16

android:theme changes specific attributes specified in the theme resource. You could instantiate specific view using any overloaded constructor, like View(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes). which basically is what inflater does.

For example v7.widget.Toolbar tries to create themed context out of resource android:themeright in the super call of the constructor, which is more or less what I mentioned above. Only certain widgets override application theme using android:theme.

I'm not sure if is possible to directly specify theme, rather than instantiation mentioned above, or using supported individual attribute and its related method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!