如何获取Android系统颜色? [英] How to get Android system Colors?

查看:528
本文介绍了如何获取Android系统颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找获取Android系统颜色的方法-设备中使用的颜色主题.

I'm searching way to get Android system colors - color theme used in device.

使用android:color/我没有获得正确的颜色. 例如:我的设备中的背景色为BLACK,菜单背景色为DARKGREY. 设备中android:color/中的值是:仅BLACKWHITE背景.

Using android:color/ I didn't get correct colors. For example: background color in my device is BLACK, menu background color is DARKGREY. Values from android:color/ in device is: only BLACK and WHITE backgrounds.

推荐答案

非常感谢:)

最后我得到答案: Android:如何获取Java中Activity的背景色?

TypedArray array = getTheme().obtainStyledAttributes(new int[]{android.R.attr.colorBackground,}); 
int backgroundcolor = array.getColor(0, 0xFF00FF);

这篇关于如何获取Android系统颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆