Simple implementation of Android rotation map

Rotation chart is a very common effect. The core function has been realized. There are no special needs. I have nothing to study, so the packaging is not very good, and some places are relatively rough. It provides a reference for students who want to study rotation chart

At present, the test image is the image in mipmap, which is not written. The image loaded from the network can be modified in getshowview () method according to requirements

1. Timing switching

It is OK to send a delay notification through handle to change the interface, and then send the delay notification again after switching the interface of viewpage. It can also be realized through timer timer

2. Unlimited rotation effect

If we just rotate to the last page automatically and then make a judgment to switch to the first page, we can achieve the effect of rotation, but there are two problems

Look at this picture first (stolen)

I have to say that the picture P of this brother is perfect

Although you can see three pictures, in fact, there are five pictures. When there is more data, you can also add data in this way. When view4 automatically switches to view5, you can judge and switch to view2. This makes it feel that the last one is the first one. We use the method provided by viewpage to switch the interface immediately. There is no scrolling effect. When the pictures are the same, you can't see the picture Setcurrentitem (int item, Boolean Smoothscroll) of slice change

The second parameter is set to false. There is no scrolling effect during interface switching. The default value is true

All right, let's look at the code

Activity code

Finally, provide two rotation pictures encapsulated by the great God on GitHub

It is suggested that students who do not know much should first understand the basic logic and use the third-party library

https://github.com/youth5201314/banner https://github.com/bingoogolapple/BGABanner-Android

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