Android uses scrollerview to implement the category bar instance that can scroll up and down

If you don't consider deeper performance issues, I personally think scrollerview is still very easy to use. Moreover, scrollerview alone can achieve the effects that can be achieved by type recyclerview or listview.

Next, I only consider the effect display, and use scrollerview to realize the scrollable multi item classification as shown in the figure below, just to share new ideas with you. (usually: Considering reusability, it is obviously flawed ~)

Feature Description:

1. Scroll up and down

2. There is a style similar to grid layout

3. The sub item has a click event

When I first saw this effect, I first thought of using typed recyclerview or listview, which is nested with GridView.

But when I think about it, scrollerview can also scroll. Just add sub items to it in a loop.

The logic of implementation is as follows:

The specific implementation is as follows:

Step 1: write a scrollerview in the layout and add a vertical linear layout

Step 2: instantiate vertical linear layout

Step 3: networking request to obtain data

Step 4: set the layout of two items

The first item layout: item_ allhornors0.xml

The second item layout: item_ allhornors1.xml

Step 5: assembly data

Click event listening:

Complete~

Take another look at the final effect:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

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
分享
二维码
< <上一篇
下一篇>>