I want to gather all the possible touches from my entire screen. I implemented a
@Override
public boolean onTouchEvent(MotionEvent e)
{
double x = e.getX();
double y = e.getY();
}
But now I added a TableView to the "scene" and when I click on it the above method is not being called because the TableView is swallowing the Touches.
Everything around the yellow area is clickable but the yellow area itself not. I want it to be clickable as well, basically I want that all the time the WHOLE screen area is clickable so I can store touch positions. How to do it?
EDIT: The onTouchEvent method is in MainActivity class. Here is the activity_main.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow android:layout_height="wrap_content">
<TextView
android:id="@+id/column1"
android:text="tapcount"
android:layout_height="wrap_content"
/>
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>
cover whole view with your own transparent, like this:
then use your code for
View
with id=cover and return alwaysfalse
in youronTouchEvent
as in doc:with
false
hardcodedMotionEvent
will be delivered to views below/under