Guest User

Untitled

a guest
Jan 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public class MyTouchLayout extends LinearLayout {
  2. @Override
  3. public boolean onInterceptTouchEvent(MotionEvent ev) {
  4. // Do whatever with your touch event
  5. return false; // Do not prevent the rest of the layout from being touched
  6. }
  7. }
  8.  
  9. <com.example.MyTouchLayout
  10. ...
  11. >
  12.  
  13. <!-- The rest of your layout -->
  14.  
  15. </com.example.MyTouchLayout>
  16.  
  17. View v = findViewById(android.R.id.content); // Find the root View; you may have to give it your own ID in the XML, and use that
  18. v.setOnTouchListener(new OnTouchListener {
  19. // ...
  20. }
Add Comment
Please, Sign In to add comment