I have this button that has a 9patch background with transparent parts, but the whole button has this darken effect like this:
And here is the button xml 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 is how this button has to look:
And here is the 9 patch background image:
This darken effect only happens on Lollipop Android version.. so does anyone knows where does this darken effect come from?
I ran into this issue with lollipop, for some reason the default button style has this darken effect
solved it by making this custom style:
<style name="ButtonStyle" parent="Widget.AppCompat.Button.Borderless">
<item name="android:background">@drawable/trans</item>
</style>
assigning it to the button:
<Button
....
style="@style/ButtonStyle" />
here's how to looks with and without the style:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With