Devrath
Devrath

Reputation: 42824

How to change the Text color of collapsing toolbar and the back button color of collapsing toolbar in android

Is there any library to achieve this effect below

enter image description here

Upvotes: 1

Views: 3079

Answers (1)

Booger
Booger

Reputation: 18725

The CollapsingToolBar that is in the Android Design lib will do what you are asking.

You will need to apply a custom toolbar theme. Here is an example (this IS your styles.xml file).

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="CustomToolbarTheme" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <!-- HERE ARE THE CHANGES - Change color of different texts -->
        <item name="android:textColorPrimary">@color/wacky_blue</item>
        <item name="colorControlNormal">@color/toolbar_color</item>
    </style>


</resources>

then you will need to set this on your App Bar:

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        ...
        android:theme="@style/CustomToolbarTheme"
        ...>

Upvotes: 7

Related Questions