Add RaiflatButton to your project
masterTo use RaiflatButton, add the following dependency to your build.gradle file using Groovy syntax:
dependencies {
compile 'com.github.rubensousa:raiflatbutton:0.1'
}repository·master·Indexed 43 days ago
https://github.com/rubensousa/raiflatbuttonAn Android library providing RaiflatButton and RaiflatImageButton components that feature a raised appearance which lowers to 0dp elevation when pressed. Designed to work with AppCompat styles, it allows for standard theme attribute reuse and provides a setFlatEnabled(false) method to disable the custom elevation behavior.
To use RaiflatButton, add the following dependency to your build.gradle file using Groovy syntax:
dependencies {
compile 'com.github.rubensousa:raiflatbutton:0.1'
}Because RaiflatButton and RaiflatImageButton extend AppCompatButton and AppCompatImageButton respectively, you can apply standard AppCompat styles to them. This allows you to reuse existing theme attributes like colorControlNormal.
<style name="RaiflatButtonPrimaryStyle" parent="Base.Widget.AppCompat.Button.Colored">
<item name="android:colorControlNormal">?attr/colorPrimary</item>
</style>You can include RaiflatButton or RaiflatImageButton directly in your XML layout files. RaiflatButton is used for text buttons, and RaiflatImageButton is used for icon-based buttons.
<com.github.rubensousa.raiflatbutton.RaiflatButton
android:id="@+id/normalButton"
style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Colored" />
<com.github.rubensousa.raiflatbutton.RaiflatImageButton
android:id="@+id/imageButton"
style="@style/Base.Widget.AppCompat.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_android" />If you want to disable the custom elevation behavior and return to standard button behavior, call setFlatEnabled(false) on the button instance in your Java code.
button.setFlatEnabled(false);