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 that comes with the Google SDK and can be used
()-endevent.gety () >) {toast.maketext (this, "gesture swipe up", toast.le Ngth_short). Show (); return true;} else if (startevent.gety ()-endevent.gety () Event Explanation:1. Ondown (motionevent e): down event; 2. Onsingletapup (motionevent E): one click Up event; 3. Onshowpress (motionevent E): When the Down event occurs and move or up does not occur before the event is triggered; 4. Onlongpress (motionevent E): Long press event; 5. Onfl
I've been working on Android for a while, and have taken the time to take a break and get ready to share some of the projects with Android experience.In the Android development process, often encounter the transition between the effects of the problem, the following describes how to achieve the transition between left and right sliding, first understand the imple
One: Gesturedetectorhttp://blog.csdn.net/jjwwmlp456/article/details/21282239 is good at writing, butThere are errors in the blog post, the correct wording is:@Overridepublic boolean onfling (Motionevent E1, motionevent E2, float Velocityx, float velocityy) {if (E1.getx ()-e2.getx () >120) {//left slide, right displayToastutils.showshorttoast (Personalcenteractivity2.this, "left slide, right display");}if (E1.getx ()-e2.getx () Toastutils.showshorttoast (Personalcenteractivity2.this, "right slide
Android Data batch loading-swipe to bottom auto load listMay 9, 2014This blog post describes how to do data batch loading, in the application development will be used to the ListView, click More load data is we often simple, in order to provide the user experience, when the user scrolls the list to the bottom of the automatic loading of data, this form is used more.Here is an example of how to simulate 20 d
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 is an animated effect, and the white stripes
the size of the setting. swipe:swipeoffsetleft= "0DP" NBSP; swipe:swipeoffsetright= "0DP" NBSP; take a look at the item layout file, which includes the front and back, Two overlapping: This layout is a regular layout and I won't explain it.Mainactivity.java, there are notes in the key places.public class Mainactivity extends Activity {private Swipelistview mswipelistview; Private Swipeadapter Madapter; public static int devicewidth; Private list data adapter: public class Swipeadap
Set the scrolling monitor to determine the scroll direction of the ListView while getting the screen height, the actual height of the ListView, to determine if it is necessary to show back the top button (see Code for specific logic-with detailed comments).:Http://www.dwz.cn/zG99WSource Run dynamic diagramOther great article articlesAndroid KSOAP2 call. NET Webservicejquery Tutorial (8)- Using the reverse Insert method for DOM tree operation Android L
Our phone Address book generally has this effect, such as:OK, this effect everyone has seen more, basically all of the Android phone address book has this effect. So let's see how this works out today.I. Overview 1. Page function analysisOn the whole, the left is a ListView, the right is a custom view, but the left side of the ListView is a little bit different from the one we normally use, that is, in the ListView I grouped all the contacts, Then the
:
123
public boolean onTouch(View v, MotionEvent event) { returnmGestureDetector.onTouchEvent(event);}
See the source code of the Gesturedetector class ontouchevent to know, enter the function will enter the case motionevent.action_up this path, so call onfling function.This is what I want to say, because in my opinion gesturedetector may not be able to meet all the gesture needs, Ken can have one day, we need to throw away gesturedetector directly in the Ontouch
.
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 g
that the sliding exceeds the threshold, and in fact the gallery also does some initialization when the hand starts moving (gallery is not yet moved), causing an error when the gallery really moves.Workaround, when you swipe your finger within the threshold, you keep doing this initialization so that when the gallery really starts moving, there is no error in initialization.public class Mygallery extends Gallery {float Mlastmotionx = 0;public mygaller
Android listview viewpager Sliding Bounce Conflict resolutionListViewnested inViewPagewith or sliding gesture conflict resolutionusing on the ListView Addheaderview Add in the first column Viewpager as HeaderSuch as:When a sliding event is triggered, it is easy to cause a sliding conflict (such as a ListView will bounce when sliding viewpager diagonally)In particular, when a pull-down or pull-up is loaded, the component may be passed to the ViewpagerC
) {super.handlemessage (msg); Shownext (); handler.sendmessagedelayed (new Message (), ();} };Simply put, it is to send a message to himself, reminding himself that time is up, and that he should take his medicine (to do something). And then you have to tell yourself that after the 5s also take medicine, so have been taking medicine, do not give up treatment.I think, when it comes to this, it should be understood that the function of this code is to achieve automatic image switching.At this p
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
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.