android-gesture

Android how to add swipe Gesture on LinearLayout without onDown true

被刻印的时光 ゝ 提交于 2019-11-30 14:10:21
问题 I'm working on Gesture activity in android I used class to detect the swipe action is public class ActivitySwipeDetector implements View.OnTouchListener { static final String logTag = "ActivitySwipeDetector"; private Activity activity; static final int MIN_DISTANCE = 100; private float downX, downY, upX, upY; public ActivitySwipeDetector(Activity activity){ this.activity = activity; } public void onRightToLeftSwipe(){ Log.i(logTag, "RightToLeftSwipe!"); Toast.makeText(activity,

Could not get Touch event for TYPE_SYSTEM_OVERLAY

好久不见. 提交于 2019-11-30 12:41:56
I like to develop an app that is similar to Swapps .i am trying to display a button on top of any screen and that should occur only on a swiping action.I tried with the below code WindowManager.LayoutParams params = new WindowManager.LayoutParams(); params.type =WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY; params.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; params.format =PixelFormat.TRANSLUCENT; params.height = WindowManager.LayoutParams.WRAP_CONTENT; params.width = WindowManager.LayoutParams.WRAP_CONTENT; parentlay = new LinearLayout(this); mybt = new Button

Android how to add swipe Gesture on LinearLayout without onDown true

一个人想着一个人 提交于 2019-11-30 09:51:15
I'm working on Gesture activity in android I used class to detect the swipe action is public class ActivitySwipeDetector implements View.OnTouchListener { static final String logTag = "ActivitySwipeDetector"; private Activity activity; static final int MIN_DISTANCE = 100; private float downX, downY, upX, upY; public ActivitySwipeDetector(Activity activity){ this.activity = activity; } public void onRightToLeftSwipe(){ Log.i(logTag, "RightToLeftSwipe!"); Toast.makeText(activity, "RightToLeftSwipe", Toast.LENGTH_SHORT).show(); //activity.doSomething(); } public void onLeftToRightSwipe(){ Log.i

Detect swipe using onTouchListener in ScrollView

六月ゝ 毕业季﹏ 提交于 2019-11-30 05:49:08
问题 I'm using the following code to detect swipe in my Activity: getWindow().getDecorView().getRootView().setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); if(action == MotionEvent.ACTION_DOWN){ downX = event.getX(); downY = event.getY(); //mSwipeDetected = Action.None; return true; // allow other events like Click to be processed } else if(action == MotionEvent.ACTION_UP || action == MotionEvent.ACTION_CANCEL)

Path intersection in android

浪子不回头ぞ 提交于 2019-11-29 21:10:24
问题 I have 2 path objects in my android code.I have tried all the way to check whether these paths are intersected or not, but not able to do it. How can I check whether the paths are intersected or not. Appreciate any good response, Thanks ! 回答1: have a look at Region.op I haven't tried it but I would suggest to use: Region.setPath(Path path, Region clip); to get a region from both of your paths and afterwards you can use: if (region1.op(region2,Region.Op.INTERSECT)) { // intersection } to check

Pinch-zoom on a ListView

纵饮孤独 提交于 2019-11-29 11:55:35
I have a ListView which contains a few TextView's arranged using a custom adapter. What I would like to do, is implement pinch-to-zoom on this ListView, so that when the user pinches, they can increase or decrease the size of the text. Does anyone know of examples of doing something similar to this? I tried following the code here: Pinch zoom for custom view , but I ended up with a ListView that would not respond to any touch events except the pinch gesture. I'm hoping this is possible without writing a new class that extends ListView. sunils34 You should be able to follow the Pinch zoom for

Viewpager in Android to switch between days endlessly

倖福魔咒の 提交于 2019-11-28 08:51:00
I am currently making a app where students can view there lesson grid. The lessons are retrieved using a json file . Now the date changing is done via buttons in the actionbar, but i want to make it also work with smooth swipe effects. The only things that need to change is the SlectedDate-1 on left swipe . the SelectedDate+1 on right swipe . I tried it with ViewPager s but it didn't work does anybody know how to do it? Maybe something with 3 viewpagers?, please a detailed code because I'm not very familar with viewpagers code! I've tried out Android ViewPager working with date code but it

How to implement a “Two Finger Drag” gesture on Android?

China☆狼群 提交于 2019-11-28 06:03:42
I am new to Android development and am working on an accessibility research project for blind people (Jelly Bean API level 17 project). I have been experimenting with some gestures and the Two-Finger-Drag gesture has been really tough to implement. The following image captures what I actually require quite well. I want the blind user to drag two fingers across horizontally (anywhere on the screen) and he would obtain an Audio output of the text he/she typed in the EditText. Also according to the distance the two fingers travel while dragging, we output each word separately.(Example below)

Pinch-zoom on a ListView

大憨熊 提交于 2019-11-28 05:30:19
问题 I have a ListView which contains a few TextView's arranged using a custom adapter. What I would like to do, is implement pinch-to-zoom on this ListView, so that when the user pinches, they can increase or decrease the size of the text. Does anyone know of examples of doing something similar to this? I tried following the code here: Pinch zoom for custom view, but I ended up with a ListView that would not respond to any touch events except the pinch gesture. I'm hoping this is possible without

How to implement a “Two Finger Drag” gesture on Android?

女生的网名这么多〃 提交于 2019-11-27 05:38:15
问题 I am new to Android development and am working on an accessibility research project for blind people (Jelly Bean API level 17 project). I have been experimenting with some gestures and the Two-Finger-Drag gesture has been really tough to implement. The following image captures what I actually require quite well. I want the blind user to drag two fingers across horizontally (anywhere on the screen) and he would obtain an Audio output of the text he/she typed in the EditText. Also according to