0

I've created the project from default template Bottom Navigation Activity. I found that the background color for BottomNavigationView is #2D2D2D for dark theme. I defined it in colors.xml, but I'm not sure that it's good solution. Is there any pre-defined colors in system(smth like @android:color/theColorThatINeed)? Where can I see all of them?

3 Answers 3

1

the best practice is to use colors.xml, and put there all of your colors, and then call it like this:

android:background="@color/red" 

there are also system constants for colors, which contains this constants: http://developer.android.com/reference/android/R.color.html

this resources are read only and you can not add to them more constants.

Sign up to request clarification or add additional context in comments.

Comments

0

Unfortunately there isn't a single place to find all the 'system colours'. You can either find them through documentation, which is usually easy with the material components (which is where BottomNavigationView is from), or by trawling through the source code. For your particular example the colour you're after is ?attr/colorSurface, which is in the documentation and the source code.

1 Comment

Thanks a lot, I didn't notice that there is answer in documentation!
-1

Is there any pre-defined colors in system?

Yes, there is but it's limited. These colors are defined in android.R.color. Here are some of them.

background_dark background_light black darker_gray holo_blue_bright holo_blue_dark holo_blue_light holo_green_dark holo_green_light holo_orange_dark holo_orange_light holo_purple holo_red_dark holo_red_light transparent white widget_edittext_dark 

To use them:

android:background="@android:color/background_dark"/> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.