Muhammad Ahmed AbuTalib
Muhammad Ahmed AbuTalib

Reputation: 4292

colorButtonNormal has no effect?

I am trying to apply a unified style on my button.

This is my v21/styles.xml

<style name="DefaultButton" parent="Widget.AppCompat.Button.Colored">
    <item name="android:colorButtonNormal">#f00</item>
    <item name="android:textColor">@color/colorTextSecondary</item>
</style>

I apply this to my button like this

<Button
                android:id="@+id/submit_btn"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginTop="@dimen/unit_large"
                style="@style/DefaultButton"
                android:text="Lemme In!" />

nothing fancy going on in here. Yet the color of my button doesn't change. Did something change over the material support packages? I am using '25.3.1'

Actually all of this is part of a greater effort I have to do to change the default button style of the application like this

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="android:buttonStyle">@style/DefaultButton</item>
</style>

I would then remove the individual styling attributes on all the buttons

Upvotes: 2

Views: 845

Answers (1)

MinnuKaAnae
MinnuKaAnae

Reputation: 1646

Change this style="@style/DefaultButton" to android:theme="@style/DefaultButton"

Upvotes: 5

Related Questions