Android imitates the cascade fade in and fade out display effect of the to circle profile interface

The implementation effect of a simulated to circle personal data interface made a few days ago

The following is the effect GIF diagram of to circle:

@H_ 419_ 5@

In fact, it took an afternoon to do this thing. At the beginning, I didn't make clear my ideas, so I began to do it blindly. Instead, I got half the result with half the effort.

In the future, we should learn a lesson, first think about the logical relationship in detail, and then start writing code, which is easier to straighten out.

It can be seen that it is not difficult to achieve this effect. The score is as follows @ H_ 502_ 14 @ three steps:

@H_ 502_ 14@1 : first you need to have a draggable detail layout (lower half).

@H_ 502_ 14@2 : the upper half can follow.

@H_ 502_ 14@3 : the title block is hidden from display.

The technical points involved are:

@H_ 502_ 14@1 : screen pixel density DP conversion.

@H_ 502_ 14@2 : ontouchlistener event for custom views

@H_ 502_ 14@3 Use of transparency attribute Animation:

According to these three requirements, the design layout is as follows:

userinfo_ layout. xml

@H_ 502_ 14 @ the layout is nested in three layers from inside to outside, and I directly cut the graph of to circle in the upper part.

Code implementation:

Code implementation idea:

It is mainly used for the following three layout operations:

@H_ 502_ 14@LinearLayout myscrollLinearlayout; // The detailed interface that can be dragged at the bottom is LinearLayout mainheadview// Top profile view relativelayout mainactionbar// Top menu bar

First initialize the position of each layout part, and then mainly listen to the dynamic event of dragging the layout at the bottom.

It is troublesome to handle the interaction with the other two layouts in this listening method, but there are detailed comments in the code.

Then this is the effect picture I implemented:

@H_ 419_ 5@

You can see as like as two peas of To.

The above is what Xiaobian introduced to you. Android imitates the cascade fade in and fade out display effect of the to circle profile interface. I hope it will be helpful to 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
分享
二维码
< <上一篇
下一篇>>