Android: default AppTheme background colors

为君一笑 提交于 2019-12-03 08:16:57

问题


What are the default background colors for Activities in Android's AppTheme style?

I'm looking for the hex code, or something that I can reference. It should be one for the LIGHT theme and one for the DARK theme.

Or where can I look them up? I'm confused by all the files and can't find the place where they actually say the color.

Thanks for your help.

Update:

I found entries in the SDK in /data/values/colors.xml, which are referenced by

@android:color/background_holo_light
@android:color/background_holo_dark

But I cannot put them as background color of my Views: it is giving an error saying the values are not public. Is there a workaround?


回答1:


Check out this colors.xml file. If you do a Ctrl-F for "backround_holo_dark" you can find the hex code. All the other holo theme colors are there as well. Enjoy!

<drawable name="screen_background_holo_light">#fff3f3f3</drawable>
<drawable name="screen_background_holo_dark">#ff000000</drawable>
<color name="background_holo_dark">#ff000000</color>
<color name="background_holo_light">#fff3f3f3</color>



回答2:


You can use your theme's default background color by referencing the attribute:

?android:colorBackground



来源:https://stackoverflow.com/questions/19841640/android-default-apptheme-background-colors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!