I'm having a frustrating issue with a RecyclerView filled with CheckedTextViews when running on Android 5.0 Lollipop. All versions before Lollipop are fine and don't exhibit this issue. Check out the pictures below for a better understanding:
Pre-Lollipop
Lollipop
See how Lollipop only draws the selection highlight on top of just the checkbox part of the CheckedTextView? Pre-Lollipop doesn't have this issue / bug, and draws the selection highlight across the entire width of the view (which is the behavior that I want).
Here is the CheckedTextView that I'm drawing to the list:
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?attr/selectableItemBackground"
android:checkMark="@drawable/checkbox"
android:id="@+id/model_checkable_name"
android:layout_height="48dp"
android:layout_width="match_parent" />
Any ideas? I've tried a handful of various different solutions, such as android:focusable="false"
, android:duplicateParentState="true"
, android:duplicateParentState="false"
...
Thanks guys!
You can use, like in Google IO app, CheckBoxPreference to solve this, by the way I want to know if is a Lollipop issue in CheckedTextView.
I tried using backgroundselectablebordeless and it doesnt work too.
Do you solved it or is a known bug?
EDIT:
You can use a framelayout over the checkedtextview and use onClickListener with the framelayout to set checked and unchecked the checktextview. Put the framelayout and the checkedtextview inside of a relative layout: