Textview background color got changed after adding custom theme to android app

162 views Asked by At

My app interface originally looked like this. "my name" is a TextView and "my button" is a button which has an image as the background. Minimum sdk is 16.

pic 1

I changed the action bar color of the app by adding a custom theme. I used the code below.

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/MyTheme</item>
    <!-- Customize your theme here. -->
</style>
<style name="MyTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="android:background">@color/com_facebook_blue</item>
</style>

Then my output came like this. enter image description here

All the background color got changed to the new color of the app. I only need to change the color of the action bar. Can anyone help me?

1

There are 1 answers

2
T. Grigoryan On

Try this

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