I want to change the look (Style) of various views dynamically in an Activity. But on going through various blogs, I came to know that android does not support dynamically setting styles for Views programmatic / dynamic., though I am not sure.
1) 除了使用 THEMES 或使用具有预设样式的布局 xml 文件 之外,还有其他实现方式吗?
2) 是否可以为各种 View 设置不同的样式(例如绿色文本 TextView1 和红色文本 < strong>TextView2) 通过对整个 Activity 使用 setTheme()?
谢谢
最佳答案
您可以像这样更改 java 文件中的文本颜色。
textview1.setTextColor(Color.GREEN);
textview2.setTextColor(Color.RED);
关于android-layout - 动态设置 View 样式 : Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14499327/