Home > Blockchain >  selectableItemBackground is inconsistent and not highlighting the whole item
selectableItemBackground is inconsistent and not highlighting the whole item

Time:01-08

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.

CodePudding user response:

Try changing the width of your ConstrainLayout to match_parent

  •  Tags:  
  • Related