Rotary Turntable Select menu--Third party open source--circlemenu

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.