由网友(魍魉影魅)分享简介:我怎样才能得到背景颜色和文字颜色(默认为子视图)的活动中的Java?解决方案 TypedArray阵列= getTheme()。obtainStyledAttributes(新INT [] {android.R.attr.colorBackground,android.R.attr.textColorPrimar...
我怎样才能得到背景颜色和文字颜色(默认为子视图)的活动中的Java?
解决方案 TypedArray阵列= getTheme()。obtainStyledAttributes(新INT [] {
android.R.attr.colorBackground,
android.R.attr.textColorPrimary,
});
INT的backgroundColor = array.getColor(0,0xFF00FF);
INT文字颜色= array.getColor(1,0xFF00FF);
array.recycle();
How can I get background color and text color (default for child views) of an Activity in Java?
解决方案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();
相关推荐
最新文章