• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Circle menu

J Warraich

Lurker
Hi Everyone!
Actually, I'm working on an app in which I'm using a circle menu. In the menu, I want to display text as well with the icons. Does anyone know the code how to do that?
 
Hi, what type of menu you mean ?
A circle menu in android just like the one in the picture. I want to display the text along with icons like facebook, twitter, etc.
 

Attachments

  • Screen Shot 2019-04-16 at 2.51.00 PM.png
    Screen Shot 2019-04-16 at 2.51.00 PM.png
    43.2 KB · Views: 89
  • Screen Shot 2019-04-16 at 2.52.01 PM.png
    Screen Shot 2019-04-16 at 2.52.01 PM.png
    27 KB · Views: 64
Can you show us the code for the circle menu? Are you using imageView ?
MainActivity code is:---


circleMenu = (CircleMenu)findViewById(R.id.circle_menu);

circleMenu.setMainMenu(Color.parseColor("#CDCDCD"),R.drawable.ic_add,R.drawable.ic_remove)
.addSubMenu(Color.parseColor("#258CFF"),R.drawable.ic_facebook)
.addSubMenu(Color.parseColor("#6d4c41"),R.drawable.ic_twitter)
.addSubMenu(Color.parseColor("#ff0000"),R.drawable.ic_youtube)
.addSubMenu(Color.parseColor("#03a9f4"),R.drawable.ic_windows)
.addSubMenu(Color.parseColor("#1a237e"),R.drawable.ic_drive)
.addSubMenu(Color.parseColor("#ffffff"),R.drawable.ic_instagram)
.setOnMenuSelectedListener(new OnMenuSelectedListener() {

@override
public void onMenuSelected(int index) {

switch (index) { /* 0 is for close menu...*/
case 0:

selectedIndex = 1;
Toast.makeText(MainActivity.this, "Youtube", Toast.LENGTH_SHORT).show();
break;
case 1:
selectedIndex = 2;
break;
case 2:
selectedIndex = 3;
break;
case 3:
selectedIndex = 4;
break;
case 4:
selectedIndex = 5;
break;
case 5:
selectedIndex = 6;
break;
}

}


});

circleMenu.setOnMenuStatusChangeListener(new OnMenuStatusChangeListener() {
@override
public void onMenuOpened() {
selectedIndex = 0;

}

@override
public void onMenuClosed() {

switch (selectedIndex) {
case 1:

Intent intent1 = new Intent(MainActivity.this, Facebook.class);
startActivity(intent1);
break;
case 2:
Intent intent2 = new Intent(MainActivity.this, Twitter.class);
startActivity(intent2);
break;
case 3:
Intent intent3 = new Intent(MainActivity.this, Youtube.class);
startActivity(intent3);
break;
case 4:
Intent intent4 = new Intent(MainActivity.this, Windows.class);
startActivity(intent4);
break;
case 5:
Intent intent5 = new Intent(MainActivity.this, Drive.class);
startActivity(intent5);
break;
case 6:
Intent intent6 = new Intent(MainActivity.this, Instagram.class);
startActivity(intent6);
break;

}

}


});
}
 
xml code is:----




<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="#5b1566">

<com.hitomi.cmlibrary.CircleMenu
android:id="@+id/circle_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:duration="10">


</com.hitomi.cmlibrary.CircleMenu>
</RelativeLayout>
 
Back
Top Bottom