Sliding closing effect of activity in Android

Recently, I feel that the effect of closing an activity is very good, that is, gesture sliding can close the current activity, so I want to write a blog to share with you! No more nonsense, old rules, but also on the renderings first, which is more intuitive!

Project address: https://github.com/xinyitiandi/SlidingFinishDemo

Upper Code:

1. The first activity:

Layout file:

2. The second activity is the target activity to jump to

Layout file:

Note: a custom layout sildingfinishlayout is used here. I'll post the code for this layout later. Don't worry. It should be noted that the outermost layer of the layout file of the activity that you want to slide close should be wrapped by the sildingfinishlayout layout. The layout inside the sildingfinishlayout should be set with the background color, such as FrameLayout. I set the background color as "#f0f0f0" here, and the font color should be set, such as textview. I set "#000" here

In order to achieve the desired effect, add a transparent theme to the activity you want to gesture slide in the androidmainfest.xml file, such as:

Subject:

OK, that's almost it. Here's the code for customizing the layout sildingfinishlayout:

Last project address: https://github.com/xinyitiandi/SlidingFinishDemo

The above is the sliding closing effect of activity in Android introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>