Implementation of Android custom component satellite menu

Satellite menu arcmenu

I believe that when you come into contact with Android and make the transition from novice to beginner, you should know some components encapsulated by satellite menu, drawer, xutils, coolmenu and some great gods. These components are easy to find on GitHub, but sometimes you can't understand the code, including some methods and functions..... First, the rendering:

Realization effect

First, if you want to customize the component

1. The first thing is to give the attribute of the custom component. It can be seen from the rendering that the component can exist in every corner of the screen, and the position is one of its attributes.

2. Since it is a satellite menu, the surrounding radius between the main button and its attached small button should also be one of its parameters.

3. The figure on the right shows that the component contains many buttons, main buttons and auxiliary buttons, so the component should inherit ViewGroup.

1、 Define the attributes of the satellite menu, create the XML file of attr under the values package, and assign the component location attribute and radius attribute.

2、 Writing custom components

The above is the preparation of satellite menu, which has a large amount of comments.

One thing to note here. The satellite menu has different animation translation values at different positions on the screen.

If you really don't understand, you can try drawing.

3、 When using, pay attention to giving namespace

Others can explore and study by themselves.

Thank you for reading, hope to help you, thank you for your support to this site!

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