【发布时间】:2015-03-10 18:20:44
【问题描述】:
我的应用需要更改应用主题的某些属性(如 colorPrimaryDark、colorAccent)
<item name="colorPrimaryDark">@color/i_need_runtime</item>
<item name="colorPrimaryDark">@color/me_too</item>
但是这些更改必须在运行时完成,因为这些值是通过 webservice (json) 来的。因为没有任何 api 可以在运行时更改主题的值,所以我认为唯一的方法是通过 Java Reflection 更改在 xml 中定义的资源值,但我不知道该怎么做,因为在 R 中。 java有定义的ID,而不是值本身。
有什么想法吗?
【问题讨论】:
标签: android runtime android-theme material-design