gesturedetector

Android ListView with OnItemClickListener AND GestureDetector

限于喜欢 提交于 2019-11-30 03:23:56
问题 I have a the following ListActivity: public class ShowDayActivity extends ListActivity implements OnItemClickListener { private GestureDetector gestureDetector; private View.OnTouchListener gestureListener; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.day); registerForContextMenu(getListView()); gestureDetector = new GestureDetector(new MyGestureDetector()); gestureListener = new View.OnTouchListener() { @Override

Android onTouchListener for entire dialog

假装没事ソ 提交于 2019-11-29 11:59:53
I have a dialog to choose files from. This dialog contains a listview to show directories and files and has an onItemClickListener for navigation purposes. How can I react to fling events to go up in the directory structure? I tried setting an OnTouchListener on the root RelativeLayout to dispatches touch events to my GestureListener: final GestureDetector detector = new GestureDetector(new MyGestureDetector(tvCurrentPath)); dialog.findViewById(R.id.rlFilelist).setOnTouchListener(new OnTouchListener() { public boolean onTouch(View view, MotionEvent e) { detector.onTouchEvent(e); return false;

How to add a gesture detector to a view in Android

蹲街弑〆低调 提交于 2019-11-27 22:07:35
I was struggling with adding a gesture detector to a subview in my project. Do I override the parent's onTouchEvent or the child's onTouchEvent ? Do I make an OnTouchListener and add the gesture detector there? The documentation shows an example for how to add a gesture detector to the activity itself but it is not clear how to add it to a view. The same process could be used if subclassing a view (example here ), but I want to add the gesture without subclassing anything. This is the closest other question I could find but it is specific to a fling gesture on an ImageView , not to the general

How to add a gesture detector to a view in Android

瘦欲@ 提交于 2019-11-26 23:06:59
问题 I was struggling with adding a gesture detector to a subview in my project. Do I override the parent's onTouchEvent or the child's onTouchEvent ? Do I make an OnTouchListener and add the gesture detector there? The documentation shows an example for how to add a gesture detector to the activity itself but it is not clear how to add it to a view. The same process could be used if subclassing a view (example here), but I want to add the gesture without subclassing anything. This is the closest