Android:如何获取Java中Activity的背景色?

如何获取Java中Activity的背景颜色和文本颜色(子视图的默认颜色)?

回答:

TypedArray array = getTheme().obtainStyledAttributes(new int[] {  

android.R.attr.colorBackground,

android.R.attr.textColorPrimary,

});

int backgroundColor = array.getColor(0, 0xFF00FF);

int textColor = array.getColor(1, 0xFF00FF);

array.recycle();

以上是 Android:如何获取Java中Activity的背景色? 的全部内容, 来源链接: utcz.com/qa/424305.html

回到顶部