Another solution is to use the styles of the compatibility library, on a Button
or AppCompatButton
Flat Button
For text only buttons, text button, flat button:
Define the style in: style="@style/Widget.AppCompat.Button.Borderless"
<android.support.v7.widget.AppCompatButton
android:id="@+id/button1"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
Colorful The color of the text will be the one defined in colorAccent
of the theme.
Define the style in: style="@style/Widget.AppCompat.Button.Borderless.Colored"
<android.support.v7.widget.AppCompatButton
android:id="@+id/button2"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
Personalization
For personalization we can define our own style, to change the color of the text, wave color when we press, only those buttons that we want.
We change the color of the text in <item name="colorAccent">
and the color of the expansive wave in <item name="colorControlHighlight">
PrimaryFlatButton style
<style name="PrimaryFlatButton" parent="Theme.AppCompat.Light">
<item name="android:buttonStyle">@style/Widget.AppCompat.Button.Borderless.Colored</item>
<item name="colorControlHighlight">@color/colorAccent</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
to use it on the button use android:theme="@style/PrimaryFlatButton
<android.support.v7.widget.AppCompatButton
android:id="@+id/buttonAwesome3"
android:theme="@style/PrimaryFlatButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:text=" Button" />