RecyclerView and RecyclerView Encapsulation

Source: Internet
Author: User

RecyclerView and RecyclerView Encapsulation

 

RecyclerView has been used as a substitute for ListView for a long time. Since it is a substitute, it naturally has some advantages that ListView does not have. For example, you can switch between list, grid, and stagger at will. You can specify one or more items to refresh, instead of all items. In addition, you can add animations for each item to further improve the experience.

But there are also many "disadvantages"

There is not much to say about APIs and the usage of RecyclerView Stay, which is available on the Internet. Let's discuss how to put RecyclerView into the project.

We do not want to use new things. First, we are afraid of bugs, second, we are afraid of not meeting our needs, and third, we are afraid that there is no ready-made mature encapsulation class that can be used and we don't want to write it on our own.

There are many RecyclerView-based packages on github, which Stay thinks is not thorough enough. It is not convenient to use. In particular, UltimateRecyclerView is not called encapsulation. It is just a heap of code. It looks powerful and can actually use 10% of the style. Do not use this code. The more features, the more complicated it will be.

The ideal encapsulation mode of Stay is as follows:

The above is the encapsulation method Stay thinks, there is no advanced algorithm, just a simple combination of controls, flexible use of APIs. Of course, if you want to support drag, move, sticky-section-header, additional work is required. But after all, there are a few. It is necessary to encapsulate the commonly used UI forms in business requirements.

That's right. Next, Stay is about Amway. Years ago, I had been preparing to record the course for quickly setting up the MaterialDesign project (the third time). Now I have learned how to record it. At present, the course is being updated. Students who have purchased the course can learn it in advance. The way of thinking about encapsulation architecture is more useful than three open-source projects.

Although it is a paid course, it is definitely worth the money. Compared with API teaching, Stay courses are more nutritious. We will not talk about calling a specific API, nor about implementation of a function or complex UI effects (these can be google or open source lib). We will talk about how to think about them, understand the requirements from the user's perspective, control the project from the PM perspective, and design the overall structure from the architect's perspective. As for the rest, believe me, it is very simple.

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.