Currently, I have the following bottom log in button.
The XML loo
I have been through what you are going through. Long story short, you just cannot do it cleanly with a tag alone, while ensuring backwards compatibility.
The simplest and the most widely practiced method is to use a underlay, around a .
Button Code:
Wherever you need to use a button, you use this complete code.
Here is the breakdown:
myButton.myButtonUnderlay.myButton, android:background="?attr/selectableItemBackgroundBorderless". This will make it a transparent button with just the text, and backwards compatible ripples.myButtonUnderlay, you will do all the other background applications, like setting the color of the button, margins, paddings, borders, gradients, and shadows etc.myButtonUnderlay.Note: To ensure backwards compatibility, make sure that you use
android:background="?attr/selectableItemBackgroundBorderless", and NOT
android:background="?android:attr/selectableItemBackgroundBorderless"