не отрабатывает нажатие на layout

помогите плиз. хочу, что бы при нажатии на пустом месте LinearLayout отрабатывалось нажатие. делаю так. по идее ClickActivity должен сработать но нет. public void ClickActivity(View view) { Log.d(LOG_TAG, " Click"); }

<?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="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/purple_200"
        android:id="@+id/MainAct"
        android:clickable="true"
        android:onClick="ClickActivity"
        android:orientation="vertical"    >    
        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:scrollbars="none">    
            <TableLayout
                android:id="@+id/TableLayout01"
                android:layout_width="match_parent"
                android:layout_height="match_parent"></TableLayout>
        </ScrollView>
    </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

Код активити:

package com.example.arhivjournal; 
public class MainActivity extends AppCompatActivity {     
@Override
 protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity_main); 
}    
 public void ClickActivity(View view) {  
       Log.d(LOG_TAG, "Long Click");     }
 };

Ответы (0 шт):