Circlemenu on GitHub on the project homepage is: Https://github.com/zhangphil/Android-CircleMenu
Circlemenu usage is simple, Java code:
PackageCom.szugyi.circlemenu;Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.view.View;ImportAndroid.widget.TextView;ImportAndroid.widget.Toast;ImportCom.szugyi.circlemenu.view.CircleImageView;Importcom.szugyi.circlemenu.view.CircleLayout;ImportCom.szugyi.circlemenu.view.CircleLayout.OnItemClickListener;ImportCom.szugyi.circlemenu.view.CircleLayout.OnItemSelectedListener; Public classMainactivityextendsActivityImplementsOnitemselectedlistener, onitemclicklistener{PrivateTextView Selectedtextview; @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); Circlelayout Circlemenu=(circlelayout) Findviewbyid (r.id.main_circle_layout); Circlemenu.setonitemselectedlistener ( This); Circlemenu.setonitemclicklistener ( This); //This textview is only used as the default selection for the Demo Carousel button.//The default bottom-most bar is selected and then displayed in the TextView. Selectedtextview =(TextView) Findviewbyid (R.id.main_selected_textview); Selectedtextview.settext (((Circleimageview) Circlemenu.getselecteditem ()). GetName ()); } //the disc rotates to the bottom, it is considered that the entry is selected@Override Public voidonitemselected (View view,intPositionLongID, String name) {Selectedtextview.settext (name); } //selected a bar in the carousel. @Override Public voidOnitemclick (View view,intPositionLongID, String name) {Toast.maketext (Getapplicationcontext (), Getresources (). getString (R.string.start_app)+ " " +name, Toast.length_short). Show (); }}
Activity_main.xml:
<Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"xmlns:circle= "Http://schemas.android.com/apk/res/com.szugyi.circlemenu"Xmlns:tools= "Http://schemas.android.com/tools"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Tools:context=". Mainactivity " > <Com.szugyi.circlemenu.view.CircleLayoutAndroid:id= "@+id/main_circle_layout"Android:layout_width= "Fill_parent"Android:layout_height= "Fill_parent"Android:layout_above= "@+id/main_selected_textview"android:layout_gravity= "Center_horizontal"circle:firstchildposition= "South"circle:isrotating= "true"Circle:rotatetocenter= "true" > <!--circle:circlebackground= "@drawable/green" - <Com.szugyi.circlemenu.view.CircleImageViewAndroid:id= "@+id/main_facebook_image"Circle:name= "@string/facebook"Android:layout_width= "35DP"Android:layout_height= "35DP"android:src= "@drawable/icon_facebook" /> <Com.szugyi.circlemenu.view.CircleImageViewAndroid:id= "@+id/main_myspace_image"Circle:name= "@string/myspace"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/icon_myspace" /> <Com.szugyi.circlemenu.view.CircleImageViewAndroid:id= "@+id/main_google_image"Circle:name= "@string/google"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/icon_google" /> <Com.szugyi.circlemenu.view.CircleImageViewAndroid:id= "@+id/main_linkedin_image"Circle:name= "@string/linkedin"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/icon_linkedin" /> <Com.szugyi.circlemenu.view.CircleImageViewAndroid:id= "@+id/main_twitter_image"Circle:name= "@string/twitter"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/icon_twitter" /> <Com.szugyi.circlemenu.view.CircleImageViewAndroid:id= "@+id/main_wordpress_image"Circle:name= "@string/wordpress"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/icon_wordpress" /> </Com.szugyi.circlemenu.view.CircleLayout> <TextViewAndroid:id= "@+id/main_selected_textview"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:layout_alignparentbottom= "true"Android:layout_centerhorizontal= "true"Android:layout_marginbottom= "50DP"android:textappearance= "? Android:attr/textappearancelarge" /></Relativelayout>
Rotary Turntable Select menu--Third party open source--circlemenu