Android high imitation Jingdong vertical circulation scrolling news bar

The implementation idea is actually very simple, that is, a user-defined LinearLayout, and the textview can cycle vertical scrolling, and the items can be clicked. The display area displays up to 2 items, and there is the animation effect of alternating attribute vertical movement. The implementation of scrolling is controlled by threads.

Not much to say, see the effect:

code implementation

Let's set custom properties for the control first:

Then, let's look at the layout of the items:

The layout is very simple, and the effect is:

Without explanation, let's write the adapter:

Then we define the view:

As can be seen from the above, the control can display up to 2 items, and use thread control to scroll and display in turn according to the subscript of the item.

Specific use code:

Initialization data:

Bind adapter to enable scrolling thread:

That's it. I went to bed late. Welcome to clap bricks.

The above content is all about the Android high imitation Jingdong vertical cycle rolling news column. I hope it can help you!

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