RecyclerView highlights the final gallery effect and holds the layout on both sides. recyclerview Gallery

Source: Internet
Author: User

RecyclerView highlights the final gallery effect and holds the layout on both sides. recyclerview Gallery

First, give you a gif. Otherwise, it would be boring.

I forgot where I saw it .....

 

 

I have been looking for NNNNNN for a long time. I think it will take a long time to write the result based on my current capabilities. So, I 'd like to go back and try again...

Don't underestimate this. I found this one for three or four days (just my heaven)

Let's talk a little bit about code.

Step 1

Add dependency (do not ask where to add)

Compile 'com. azoft. carousellayoutmanager: carousel: 1.2.1'

 

 

Step 2

You can use the system for layout.

 

Step 3

Adapter configuration (normally writing your own logic has nothing to do with this, mainly layoutmanage)

 

 

Step 4

Activity Configuration

 

InitRecyclerView () method content ------ key points
Please refer to the following link for more information: when there are already too many threads, there are already too many threads

 

// Implement the zoom Effect

// Enable zoom effect. this line can be customized

LayoutManager. setPostLayoutListener (newCarouselZoomPostLayoutListener ());

LayoutManager. setMaxVisibleItems (2 );

RecyclerView. setLayoutManager (layoutManager );

// Fixed the item size

// We recommend CT only fixed sized item for now

RecyclerView. setHasFixedSize (true );

// Sample adapter with random data

RecyclerView. setAdapter (adapter );

// Implement intermediate item scrolling

// Enable center post scrolling

RecyclerView. addOnScrollListener (newCenterScrollListener ());

 

 

// Item sliding listener

DefaultChildSelectionListener. initCenterItemListener (newdefachilchildselectionlistener. OnCenterItemClickListener (){

@ Override

Public voidonCenterItemClicked (@ NonNullfinalRecyclerViewrecyclerView, @ NonNullfinalCarouselLayoutManagercarouselLayoutManager, @ NonNullfinalViewv ){

Final intposition = recyclerView. getChildLayoutPosition (v );

 

}, RecyclerView, layoutManager );

 

 

// Item click listener

 

LayoutManager. addOnItemSelectionListener (newreceivusellayoutmanager. OnCenterItemSelectionListener (){

@ Override

Public voidonCenterItemChanged (final intadapterPosition ){

If (CarouselLayoutManager. INVALID_POSITION! = AdapterPosition ){

 

}

}

});

 

Now we can complete the process. You can go back to multiple contact persons, because I also forgot where the original demo was (IT seems I found IT in the blue leopard) because I am in a project, so I am too lazy to write a demo. You can also try searching for carousellayoutmanager on github. Maybe you can find it and download the demo and change it to some pitfalls.

Success !!!!!

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.