android-gesture

How to handle ListView Item LongPress gesture

瘦欲@ 提交于 2020-01-23 11:52:53
问题 i have small issues in event handling , i have List view custom adapter data , each row having date , title , price . when i click on row i need to display details page but when i long press on price , date or title i need to sort the list view. i need to use gesture for on Long Press. please refer below code what i have tried. Custom Adapter View public EventAdapterView(Context context, List<EventUtil> eventList) { this.mContext = context; this.mEventUtil = eventList; mLayoutInflater =

How to know if two images are intersect while one image moving in android?

扶醉桌前 提交于 2020-01-22 21:28:40
问题 In my application, i am moving image around the screen by using onTouchListener . I have another two images in the same view. My problem is that, when the moving image, touches any of the other images, i need to perform a certain action (that means if images are intersected, then do something). How can this be achieved?.Please help me asap Thanks in Advance. 回答1: You should be able to use Rect.intersects(Rect, Rect) , like this example: Rect myViewRect = new Rect(); myView.getHitRect

How to add touch event to show latitude and longitude in a toast in OSM

☆樱花仙子☆ 提交于 2020-01-07 02:31:09
问题 How do I add this function below in my code? The url is this: how to add more marker in osm map in android please help me? I want to add feature to print toast message of every location where user touches on the screen and displays its latitude and longitude on map in toast message public boolean onTouchEvent(MotionEvent event, MapView mapView) { if (event.getAction() == 1) { GeoPoint geopoint = (GeoPoint) mapView.getProjection().fromPixels((int) event.getX(), (int) event.getY()); // latitude

How to translate the canvas and still get the touch events on the correct places

三世轮回 提交于 2020-01-03 15:54:19
问题 I'm trying to create a custom AbsListView (overriding the same stuff on ListView, GridView and HeaderGridView) that will relocate all its drawing and touching events based on an external factor (other stuff that moves on the layout). Paddings are not an option here, because then the only way to try to control the AbsListView position is using the super crappy method smoothScrollBy(int distance, int duration) and that is giving me a whole level of different issues that I'm trying to overcome

How to add our own gestures in android?

坚强是说给别人听的谎言 提交于 2020-01-01 19:56:13
问题 I am working on the gestures concept. I want know some thing about how to add our own gestures in android.For example if user drawn "O" symbol i want to make some events. Please share some tutorials and Snippet of the code. 回答1: There are quite a few results available with a relatively simple Google search. I would normally post a sarcastic comment or something. :-) But this isn't quite an everyday subject if you would, so I have here a few links that should get you started. But you should

ImageView - implementing gestures (pinch zoom, double tap) compatible with ViewPager (just like Android Gallery)

帅比萌擦擦* 提交于 2019-12-25 02:16:02
问题 I was looking for an effective way to implement gestures option to ImageView with ViewPager. I tried some examples, but they are not working well (e.g. pinch zoom actually is not zooming where I want to). In my app I need pinch zooming, double tap zoom and draging zoomed image. What is the fastest and easiest way to make it all working well? 回答1: you can try this open sources project: https://github.com/jasonpolites/gesture-imageview 来源: https://stackoverflow.com/questions/12517306/imageview

Determining Fling Direction

你离开我真会死。 提交于 2019-12-24 17:27:08
问题 I'm using a GestureDetector to have onFling() called. It seems to be correctly detecting my flings as it triggers a Log message I created. I'm trying to determine the direction of the fling, but am running into problems. The x values are the same for both MotionEvent objects passed into the onFling() method so I cannot determine the direction. For example, I get: 08-05 16:36:08.679: DEBUG/mView(14616): fling2: 131.0 131.0 When I do: Log.d("mView", "fling2: " + e1.getX() + " " + e2.getX());

Pan, Zoom and Scale a custom View for Canvas drawing in Android

偶尔善良 提交于 2019-12-23 03:22:40
问题 I'm working on a drawing app, where the user can pan & zoom to a specific portion of the screen and start drawing with zoom applied. To be more specific, I'm looking for a way to implement zoom, pinch & pan gesture in Canvas (horizontal and vertical scrolling with moveable x, y coordinates). Right now, I've successfully developed the zoom only feature but it's not accurate and the pan option is not working. See my sample code here, public class DrawingView extends View { //canvas private

How can I implement a chrome like “auto-hide navigation” for my Android app?

吃可爱长大的小学妹 提交于 2019-12-20 10:57:06
问题 In Chrome, the address bar will be hidden/shown when user swipes up/down the content. Can I implement the similar logic to my app? <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" tools:ignore="MergeRootFrame"> <WebView android:id="@+id/my_webview" android:layout_width="match_parent" android

Different fling (swipe) velocity on different Android devices with same density

懵懂的女人 提交于 2019-12-20 09:36:04
问题 I'm writing my own image viewer that enables users to swipe left\right to see the next\previous image. I want to animate the image change according to the fling velocity. To detect a fling gesture and its velocity, I followed this basic gesture detection and did as the accepted answer suggested: public class SelectFilterActivity extends Activity implements OnClickListener { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 250; private static