How to highlight a TextView or LinearLayout when click it?
android
Solution
I suppose 2 Layouts
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
>
<LinearLayout
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
>
...
</LinearLayout>
</LinearLayout>
findViewById(R.id.root).setOnClickListener(...);
Problem
I have a LinearLayout that contains three TextViews. I want to highlight a TextView or the whole Layout when user clicks on the TextView. Is they any way to make it happen? Thanks.