The realization of cool return mode in Android

Source: Internet
Author: User

The Android phone will have a return key, whether it's an entity key or a virtual key. Android users are mainly using this return key to manipulate the page return mode, no more than iOS forcing the very high only one operation key. This is the most common way to return, there is also a more common, that is, the internal response of the page itself. The vast majority of apps each page of the design on the left side of the top will have a return key icon, and occasionally have a wonderful design put on the left side of the bottom, click on this icon to finish off the current page. After simply introducing the two most common ways, here are two more friendly ways to interact with each other.

Take the interaction of three social software that you use more commonly. Tencent Weibo to return the way to remove the above mentioned two kinds, there is a way, when the gesture fell on the left side of the page, the potential sliding page also followed by sliding . When the finger is raised, the x coordinates are greater than half the width of the screen, and the page continues to slide to the right to finish the current page, and if the x-coordinate is still on the left side of the screen, the page slides to its original position and restores the current page. If there is a description unclear or not clear, please open the mobile phone Tencent Weibo experience.

There is also a way of interaction, is the current QQ, Sina Weibo adopted, the interaction is such. The position of the finger drop can be arbitrary, but when the finger is raised, as long as can satisfy two conditions, the current page will automatically finish.

Condition one, corresponding to the x coordinates of the displacement is greater than a certain threshold, probably the screen width of 1/3 of the appearance (x coordinate horizontally to the right increase)

The absolute value of the displacement of the condition two and y coordinates is less than a threshold of about 20DP, mainly to prevent the interference of y displacement (the y-coordinate increases vertically downward).

If you are not clear, open either of the experience.

Below I will introduce these two kind of relatively new interactive way realization. For convenience, I have both functions abstracted to the base class baseactivity, if which page needs to add these two interactive ways, direct inheritance can implement the function.

Interactive one implementation, the encapsulation is very good, the use is very simple

Interactive two implementations

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.