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?
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
3
Answers
the best practice is to use colors.xml, and put there all of your colors,
and then call it like this:
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.
Yes, there is but it’s limited. These colors are defined in android.R.color. Here are some of them.
To use them:
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.