Why let the user use scroll when sliding (fling) is more efficient than moving (scroll)? On mobile devices with a small footprint and a lot of data, it is difficult to display the content scroll far behind, in which case fling is more appropriate.Note: Scroll indicates how much distance the finger slips, and how much distance the interface follows, while the fling is based on your sliding direction and weight, and automatically slides a distance.Filing gestures are widely used in Android interac
When developing an Android program, sometimes you need to monitor your finger to slide the screen, and when your finger slides up and down in different directions to make a different response, how do you achieve that?Using the gesture monitor provided by Android can be easily implemented, directly on the code (tested pass)public class Cbmainactivity extends Activity implements android.view.gesturedetector.ongesturelistener{// Defines a
(rotate), swipe (sliding, fast moving, is used to monitor the direction of the slide), Pan (drag, slow move, is used to monitor the amount of offset) and longpress (Long Press).
For example, you can add in the Viewdidload function:
-(void) viewdidload
{
[super viewdidload];
Do no additional setup after loading the view from its nib.
Uipangesturerecognizer *panrecognizer = [[Uipangesturerecognizer alloc] initwithtarget:self action: @se
UIGestureRecognizer gesture operation, uigesturerecognizer
UIGestureRecognizer class is used to detect, recognize the gestures used by users when using devices, and define the basic behavior of all gestures. The following is a subclass of UIGestureRecognizer.
Click gesture
Click the gesture UITapGestureRecognizerUITapGestureRecognizer * singleTap = [[UITapGesture
Gesture Recognition Status:typedef ns_enum (Nsinteger, uigesturerecognizerstate) {No touch event occurs, default state of all gesture recognitionUigesturerecognizerstatepossible,When a gesture has started but has not changed or completedUigesturerecognizerstatebegan,Gesture State ChangeUigesturerecognizerstatechanged,
.touchstart event;2.mouseover event;3.mousemove event (once);4.mousedown event;5.mouseup event;6.click event;7.touchend event.Compatibility: iOS version of Safari, Android version of WebKit, Bada version of Dolfin, BlackBerry WebKit in OS6, Mobile10.1 in opera and LG's proprietary Phantom browser. But only safari in iOS supports multi-touch. Desktop versions of firefox6+ and chrome also support touch.Four: Gesture event in iOS2.0:
The Uigesturerecognizer class, used to detect and identify gestures used by the user when using the device, defines the basic behavior of all gestures. The following is the Uigesturerecognizer subclass, yo about handling specific user gesture behavior.Click Gestures*singletap=[[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (Singletap:)]; [Self.view Addgesturerecognizer:singletap]; // Click event -(void) Singletap: (UITapGesture
1. If we press home on the phone to return to the desktop, then we click "Application" on the desktop.2. Then locate the "set" click to enter, as shown in the figure.3. Then find the "control" button in the figure above and click on it.4. Then we'll find a "gesture sensing" option in it, and we can open it here.
5. After opening, we click on the "OK" details as shown in the picture.
6. There will be a related matter after the confirma
and uses its subclasses to handle specific gesturesUITapGestureRecognizer (PAT)Uipinchgesturerecognizer (pinch, for zooming)Uipangesturerecognizer (drag)Uiswipegesturerecognizer (swipe)uirotationgesturerecognizer (swivel)Uilongpressgesturerecognizer (Long Press)Uiscreenedgepangesturerecognizer (screen edge swipe)Code Description: The common status of gestures is as followsStart: Uigesturerecognizerstatebeg
.
Returns:
True if the event is consumed, else false
General meaning:E1 represents an event that is triggered by the moment the finger is pressed,E2 represents an event triggered when the finger is not bouncing and movingThe remaining two parameters roughly mean the number of pixels per second moving in the X, y direction.So, by E1 and E2, you can create a judging condition for gestures.Simple left and right swipe
extends:http://www.cnblogs.com/dwinter/archive/2012/02/27/androidviewpager%e5%a4%9a%e9%a1%b5%e9%9d%a2%e6%bb%91 %e5%8a%a8%e5%88%87%e6%8d%a2%e4%bb%a5%e5%8f%8a%e5%8a%a8%e7%94%bb%e6%95%88%e6%9e%9c.htmlFirst, let's take a look, this is the Sina Weibo tab slide effect. We can swipe the gesture or click on the header above to toggle it. In the same way,The white bars are moved to the corresponding tab header. This
First, let's take a look, this is the Sina Weibo tab slide effect. We can swipe the gesture or click on the header above to toggle it. In this same way, the white bar is moved to the corresponding tab header. This is an animated effect, and the white stripes are slowly sliding past. Well, then we'll do it. Second, before we begin, we must first know a control, Viewpager. It is a class of an add-on package t
#import "LZJNavigationViewController.h"#import @interface LZJnavigationviewcontroller () uinavigationcontrollerdelegate, Uigesturerecognizerdelegate> /** System gesture Agent * /@property (nonatomic, strong) ID popgesture; @end@implementation LzjnavigationviewcontrollerWhen the call is called when the program starts function : load the current class into memory and place it in the code area + (void) load{NSLog (@ "%s", __func__);//}Wh
Because the sliding effect of the page is used more throughout the application, all extracted into the parent class to introduce, see the code commentImport Android.app.activity;import Android.content.sharedpreferences;import Android.os.bundle;import Android.view.gesturedetector;import Android.view.motionevent;import Android.view.view;import Android.view.gesturedetector.simpleongesturelistener;import android.widget.toast;//defines an abstract method Shownext, which is implemented by the base cla
(mslidingmenu.ismenushowing ()) mslidingmenu.showcontent (); else finish (); return true; Case KeyEvent.KEYCODE_MENU:mSlidingMenu.showSecondaryMenu (); return true;} Return Super.onkeydown (KeyCode, event);}}Here's a look at how to solve the collision between the side slide and the Viewpager: "Of course, my source code shows how to use"Mslidingmenu.addignoredview (Viewpager);Before your Viewpager content is displayed. Call the method above. It's OK,Slidingmenu.settouchmodeabove (). This include
1.2. Function realization2.1 Layout structureThe Framelayout layout is used here, and its first child textview is the text that is displayed, and when it moves to the left, its font size slowly becomes larger, the transparency becomes clearer, and the text is eventually hidden when it slides to the right. The second child has a linearlayout and it is transparent, because when the view moves it is its child view, if you do not addLinearLayout So the entire layout slides to the left and doesn't se
Like click (clicks) is the core of the GUI platform, taps is the core of the touch platform, gesture (gestures) is the core of the Kinect application. Unlike digital interactions in a graphical user interface, gestures are a real-life activity. Without a computer we don't need a mouse, but without the Kinect, gestures still exist. Gestures, on the other hand, are part of the interaction between people in everyday life. Gestures can enhance the persuas
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.