E
E
eyewhitness2017-02-06 23:50:22
Android
eyewhitness, 2017-02-06 23:50:22

In android studio: button style output to physical. device is different from the style on the preview?

I'm experimenting with overriding different widget styles and can't solve this problem:

<resources>
    <style parent="Theme.AppCompat" name="AppTheme">
        <item name="colorPrimary">@color/red</item>
        <item name="colorPrimaryDark">@color/dark_red</item>
        <item name="colorAccent">@color/gray</item>
        <item name="android:buttonStyle">@style/BeatBoxButton</item>
        <item name="android:colorBackground">@color/soothing_blue</item>
    </style>

    <style parent="android:style/Widget.Holo.Button" name="BeatBoxButton" >
        <item name="android:background">@color/dark_blue</item>
        <item name="android:textStyle">italic</item>
    </style>
</resources>

With this redefinition of the style, the background and font style of the buttons are displayed unchanged, although everything is OK on the preview. What's the catch, folks?
actually the button:
<Button
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/list_item_sound_button"
    android:layout_width="match_parent"
    android:layout_height="120dp"
    tools:text="Sound name">

</Button>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ryabos, 2017-02-07
@Ryabos

So for the Button itself, the style attribute is not specified

E
eyewhitness, 2017-02-07
@eyewhitness

it is overridden in the AppTheme

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question