Challenge (help pls)


Does anybody find the solution?
I’ve tried this, but it made no effect.

<style name="BeatBoxButton" parent="Widget.AppCompat.Button">
        <item name="android:background">@drawable/button_beat_box</item>
        <item name="android:fadeEnabled">false</item>
        <item name="android:fadingEdge">none</item>
        <item name="android:fadeDuration">0</item>
        <item name="android:requiresFadingEdge">none</item>

Can I have some hint, @cstewart?


I don’t remember the exact solution, but i think you just want your parent to be the borderless button style:



What about overriding the stateListAnimator attribute for v21 styles and have it equal null? This seems to work for me. I used the below in my qualified styles file (v21) and it worked.

<style name="BeatBoxButton" parent="Widget.AppCompat.Button">
    <item name="android:background">@drawable/button_beat_box</item>
    <item name="android:stateListAnimator">@null</item>

I was able to find the below in one of the stackoverflow posts.

<!-- Bordered ink button -->
<style name="Widget.Material.Button">
    <item name="background">@drawable/btn_default_material</item>
    <item name="textAppearance">?attr/textAppearanceButton</item>
    <item name="minHeight">48dip</item>
    <item name="minWidth">88dip</item>
    <item name="stateListAnimator">@anim/button_state_list_anim_material</item>
    <item name="focusable">true</item>
    <item name="clickable">true</item>
    <item name="gravity">center_vertical|center_horizontal</item>

Since the effect happened when moving between states, I thought that the stateListAnimator was the reason for the shadow. I didn’t think about the background at all, which is the only overriding attribute in the borderless theme, as below:

<style name="Base.Widget.AppCompat.Button.Borderless">
    <item name="android:background">@drawable/abc_btn_borderless_material</item>

So, the borderless button casts no shadow, that makes sense.

Further, one more question, in my android studio, the cmd+click worked from my values file. It took me to

From there cmd+click didn’t actually work, I used the find tool to find the relevant themes and attributes. Any idea why this is happening?

FYI: I do use org.gradle.caching=true in my gradle properties.


For me, using Widget.AppCompat.ImageButton as a parent was enough to have nice buttons without a border or extra shading.

<style name="BeatBoxButton" parent="Widget.AppCompat.ImageButton">
    <item name="android:background">@drawable/button_beat_box</item>