I have made an AppCompat button like this:
<android.support.v7.widget.AppCompatButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="@+id/categoryButton"
android:drawableRight="@drawable/ic_close_white_24dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
style="@style/GenericButtonStyle"/>
And it is styled as this:
v21:
<style name="GenericButtonStyle" parent="Widget.AppCompat.Button.Colored">
<item name="android:colorButtonNormal">@color/color_accent</item>
<!--<item name="android:background">@color/color_accent</item>-->
<item name="android:textColor">@color/white</item>
<item name="android:elevation">2dp</item>
</style>
v16: (All the rest - minimum being Android 4.0)
<style name="GenericButtonStyle" parent="Widget.AppCompat.Button.Colored">
<item name="colorButtonNormal">@color/color_accent</item>
<item name="android:textColor">@color/white</item>
</style>
I am getting the desire background and touch feedback but there is no ripple affect on Lollipop+ devices. I want normal touch feedback on pre-lollipop devices and the ripple affect on lollipop devices. Please guide.
Basic ripple setup
Ripples contained within the view.
android:background="?attr/selectableItemBackground"
Ripples that extend beyond the view's bounds:
android:background="?attr/selectableItemBackgroundBorderless"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.