Back to project page Joetz-Android-V2.
The source code is released under:
GNU General Public License
If you think the Android project Joetz-Android-V2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.jens.myapplication.view; //from w w w. j a v a2 s. c om import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.LinearLayout; /** * Can be used to listen to touch events from the dispatchTouchEvent method */ public class MyLinearLayout extends LinearLayout { private OnDispatchTouchEventListener onDispatchTouchEventListener = null; public MyLinearLayout(Context context) { super(context); } public MyLinearLayout(Context context, AttributeSet attrs) { super(context, attrs); } public MyLinearLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public boolean dispatchTouchEvent(MotionEvent ev) { if(onDispatchTouchEventListener != null){ onDispatchTouchEventListener.onDispatchTouchEvent(ev); } return super.dispatchTouchEvent(ev); } public void setOnDispatchTouchEventListener(OnDispatchTouchEventListener listener){ this.onDispatchTouchEventListener = listener; } public interface OnDispatchTouchEventListener{ public void onDispatchTouchEvent(MotionEvent e); } }