Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

selectableItemBackground is inconsistent and not highlighting the whole item

android:background="?android:selectableItemBackground" is not highlighting the whole item.

screenshot of the issue

 <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:clickable="true"
  android:background="?android:selectableItemBackground"
  android:focusable="true">

  <com.google.android.material.imageview.ShapeableImageView
    some code/>

  <TextView
    some code />

</androidx.constraintlayout.widget.ConstraintLayout>

I am still confused why is this happening even if i have set focusable and clickable as true.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try changing the width of your ConstrainLayout to match_parent

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading