javaandroidfocusable

Android How to LinearLayout (or other views) set clickable and focusable


Like this

I want to set focusable and clickable mode for LinearLayout (like in above image). How to I make this?


Solution

  • try this, it worked for me

    <LinearLayout android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"
                  android:clickable="true"
                  android:focusable="true"
                  android:background="?android:attr/selectableItemBackground">
    </LinearLayout>