Setting Android Toolbar Background and Text Colors in Android Studio 1.4.1

Deadly 提交于 2019-11-30 02:33:26

So, if like me you are using Android Studio 1.4.1 and you are new to android programming, setting title and background colors can be done as follow :

Background:(check colors.xml with this generated code for BlanckActivity)

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color><!--Background color for AppBar-->
    <color name="colorPrimaryDark">#303F9F</color><!--i ignore its use-->
    <color name="colorAccent">#FF4081</color><!--color effects, EditText, RadioButtons...-->
</resources>

Title,Subtitle and popup menu and its items (check "styles.xml") :

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
        <item name="android:textColorPrimary">TITLE_COLOR_GOES_HERE</item>
        <item name="android:textColorSecondary">SUBTITLE_COLOR_GOES_HERE</item>
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
        <item name="android:colorBackground">MENU_POPUP_BACK_COLOR</item>
        <item name="android:textColor">@color/MENU_POPUP_ITEMS_COLOR</item>
</style>

I hope this can help someone who like me is confused in first steps provided with official android tutorials.

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