This is a simple implementation of a circle menu for Android applications.
ConstraintLayout 1.1.0 is now supporting circular positioning, which makes the use of this library deprecated.
Grab via Maven
<dependency>
<groupId>com.github.szugyi</groupId>
<artifactId>Android-CircleMenu</artifactId>
<version>2.0.0</version>
</dependency>
or Gradle:
compile 'com.github.szugyi:Android-CircleMenu:2.0.0'
Snapshots of the development version are available in Sonatype's snapshots
repository.
Android-CircleMenu requires Android 4.0.
firstChildPosition
([East
,South
,West
,North
]) - The angle where the first child of the CircleLayout will be put. Possible values are:East
- to the right,South
- to the bottom,West
- to the left,North
- to the top. Default:South
isRotating
(boolean) - Determines wether the child views are rotatable or not. Default: truespeed
(integer) - You can set the speed of the rotation. NOTE: The higher the value, the faster the rotation. It must be greater than 0. Values between 10 - 100 should work well. Default: 25radius
(dimension) - The radius of the circle can be defined using dps or pixels.
OnItemClickListener
- Called when a child view is tapped. If theisRotating
attribute is set to true, then called only if the tapped view is already on thefirstChildPosition
.OnItemSelectedListener
- If theisRotating
attribute is set to true, then it is called when the view is rotated to thefirstChildPosition
. Otherwise it is called with theOnItemClickListener
when the child is tapped.OnCenterClickListener
- Called when the center of the CircleLayout is tapped.OnRotationFinishedListener
- If theisRotating
attribute is set to true, then it is called when the rotation is finished, and passes the view which is on thefirstChildPosition
. Otherwise it is never called.
Description about the changes made to each version of the project can be found in the CHANGELOG.md file.
Special thanks to Balázs Varga, who helped me during the implementation of this custom view.
A lot of code snippets have been used from this great tutorial: http://mobile.tutsplus.com/tutorials/android/android-sdk-creating-a-rotating-dialer/
The icons used in the example app are from: http://flaticons.net/