I have Spinner with custom layout for its dropdown view using CheckedTextView. The checkedtextview have custom background to use custom color and corner radius. But the ripple effect kinda ruin its UI. How to disable the ripple?
I have tried using set rippleColor
, itemRippleColor
and foreground
to null or transparent, but it doesnt work. Here is my code
Spinner:
<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/spnSelectYear"
android:layout_width="@dimen/dimen_0dp"
android:layout_height="wrap_content"
style="@style/SpinnerTheme"
android:layout_weight="1"
android:entries="@array/array_year" />
Spinner theme:
<style name="SpinnerTheme" parent="android:Widget.Material.Spinner.Underlined">
<item name="android:background">@drawable/bg_spinner</item>
<item name="android:popupBackground">@drawable/bg_rounded_white</item>
<item name="overlapAnchor">false</item>
<item name="android:textAlignment">textStart</item>
</style>
Item Dropdown:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.AppCompatCheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tvYear"
style="@style/TextAppearance.AppCompat.Widget.TextView.SpinnerItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dimen_10dp"
android:layout_marginVertical="@dimen/dimen_4dp"
android:background="@drawable/selector_background_dropdown"
android:maxLines="1"
android:padding="@dimen/dimen_20dp"
tools:text="Select" />