Imitation millet and iPhone calendar effect based on Android week view

preface

Recently, due to the needs of the project, we need to make a function to imitate the Xiaomi calendar. The following shows the schedule of the day. The header slides in weeks. We haven't found a suitable one on GitHub for a long time, but we have found a similar open-source project Android week view. It is not the effect required by our project, but it helps us to add events and process events, This saves us a lot of work. The effect of Android week view is shown in the figure below

No more nonsense. Let's see the effect of my project first

It mainly includes two core classes and two definition controls. The weekheaderview above and the weekdayview below are inherited views. Then calculate the position, draw the week label above and the day text below, and control sliding and handling various events through scroller and gesturedetector. No more nonsense, just teach you how to use it.

The first is the layout file. You can control the text size, background color, focus color and so on through properties.

java code

Weekheaderview and weekdayview monitor each other's sliding to achieve linkage. The first time I wrote a blog, I said so much. Interested friends can go to GitHub and download the source code. I won't make a fool of myself.

Download address: sample Android week view

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