Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyTouchLayout extends LinearLayout {
- @Override
- public boolean onInterceptTouchEvent(MotionEvent ev) {
- // Do whatever with your touch event
- return false; // Do not prevent the rest of the layout from being touched
- }
- }
- <com.example.MyTouchLayout
- ...
- >
- <!-- The rest of your layout -->
- </com.example.MyTouchLayout>
- 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
- v.setOnTouchListener(new OnTouchListener {
- // ...
- }
Add Comment
Please, Sign In to add comment