2

I'm trying to style the buttons with the new supportv7 v22.1.1

It works fine on device with Lollipop, but on older device, it doesn't apply the theme anymore.

The themes.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:buttonStyle">@style/Button</item>
    </style>

    <style name="Button" parent="Widget.AppCompat.Button">
        <item name="android:textColor">@color/white</item>
        <item name="android:background">#1FA561</item>
    </style>

</resources>

the manifest does include android:theme="@style/AppTheme"

Basic layout file

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".LoginActivity">

    <ScrollView
        android:id="@+id/login_form"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/email_login_form"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <Button
                android:id="@+id/email_sign_in_button"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:text="@string/action_sign_in"
                android:textStyle="bold" />

        </LinearLayout>
    </ScrollView>

</LinearLayout>

Nexus 4 on 4.4.4

Michael B.
  • 3,410
  • 1
  • 21
  • 32

1 Answers1

0

sorry to say this but, BUTTON style support not included in appcompat-v7

still want solution check this answer and you can also use any third party library for material button style

Community
  • 1
  • 1
Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177
  • Thing is, it used to work, and then it stops, anyway i'm applying the theme on all button, it sucks, but it was simplest solution – Michael B. Aug 13 '15 at 15:09