android - Gather Touches from MainActivity -
i want gather possible touches entire screen. implemented a
@override public boolean ontouchevent(motionevent e) { double x = e.getx(); double y = e.gety(); }
but added tableview "scene" , when click on above method not being called because tableview swallowing touches.
everything around yellow area clickable yellow area not. want clickable well, want time whole screen area clickable can store touch positions. how it?
edit: ontouchevent method in mainactivity class. here 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 own transparent, this:
<relativelayout> <linearlayout android:layout_height="fill_parent" android:layout_width="fill_parent"> <!--your content inside--> </linearlayout> <view android:id="@+id/cover" android:layout_height="fill_parent" android:layout_width="fill_parent"/> </relativelayout>
then use code view
id=cover , return false
in ontouchevent
in doc:
returns true if event handled, false otherwise.
with false
hardcoded motionevent
delivered views below/under
Comments
Post a Comment