Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListView item with checkbox - how to remove checkbox ripple effect?

Tags:

I have a ListView with item contains a checkbox and some other elements. The problem is when I click on the list item on Android 5+ device I have it looks like this:

enter image description here

I don't want to have ripple effect around the checkbox. How can I acheive that?

Item XML code:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"           android:orientation="horizontal"           android:layout_width="match_parent"           android:layout_height="@dimen/list_item_height"           android:gravity="center_vertical"           android:paddingLeft="@dimen/activity_horizontal_margin"           android:paddingRight="@dimen/activity_horizontal_margin">      <CheckBox         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/item_check"         android:checked="false"         android:focusable="false"         android:layout_marginRight="32dp"         android:clickable="false"/>      <TextView         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/item_title"         android:textAppearance="@android:style/TextAppearance.Medium"         android:maxLines="1"         android:lines="1"/>  </LinearLayout> 
like image 509
udenfox Avatar asked Feb 25 '16 11:02

udenfox


1 Answers

Try setting Background as Transparent to Checkbox

android:background="@android:color/transparent"

Hope it helps.Thanks

like image 199
Jagjit Singh Avatar answered Oct 11 '22 20:10

Jagjit Singh