Button with transparent background gets dark in Lolipop android

I have this button with a 9patch background with transparent parts, but the whole button has this dark effect:

darken button

And here is the xml button code:

<Button android:id="@+id/login_operator" android:layout_width="match_parent" android:layout_height="40dp" android:layout_margin="5dp" android:background="@drawable/white_rounded" android:drawableRight="@mipmap/arrow_white_down" android:gravity="left|center_vertical" android:text="@string/select_operator" android:textAppearance="?android:attr/textAppearanceMedium" /> 

Here's what this button should look like:

enter image description here

And here are 9 background images of the patch:

enter image description here

This dimming effect only happens on Lolipop android version. So does anyone know where this dark effect comes from?

+6
source share
1 answer

I ran into this problem with lollipop, for some reason the default button style has this dark effect

decided to do this by doing this style:

 <style name="ButtonStyle" parent="Widget.AppCompat.Button.Borderless"> <item name="android:background">@drawable/trans</item> </style> 

assigning it to a button:

 <Button .... style="@style/ButtonStyle" /> 

Here's how to look with and without style:

enter image description here

+3
source

All Articles