4

I am trying to create a round circle menu like this:

like this

I am using ArcMenu Library. My xml code is

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:arc="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <com.capricorn.ArcMenu
        android:id="@+id/arc_menu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       />
</LinearLayout>

and MainActivity.java:

public class MainActivity extends Activity {
private static final int[] ITEM_DRAWABLES = { R.drawable.composer_camera, R.drawable.composer_music,
        R.drawable.composer_place, R.drawable.composer_sleep, R.drawable.composer_thought, R.drawable.composer_with };

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ArcMenu menu = (ArcMenu) findViewById(R.id.arc_menu);

    ArcLayout arcLayout= new ArcLayout(this);
    arcLayout.setChildSize(50);
    arcLayout.setArc(0.0f, 300.0f); 



    final int itemCount = ITEM_DRAWABLES.length;
    for (int i = 0; i < itemCount; i++) {
        ImageView item = new ImageView(this);
        item.setImageResource(ITEM_DRAWABLES[i]);

        final int position = i;
        menu.addItem(item, new OnClickListener() {

            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "position:" + position, Toast.LENGTH_SHORT).show();
            }
        });// Add a menu item
    }
}


}

And output is not coming in rounded way.

Output coming is in this way:

enter image description here

Please suggest me how i can set rounded menu I am in new in android So please help me

Sankar V
  • 4,794
  • 3
  • 38
  • 56
Kuldeep
  • 367
  • 2
  • 7
  • 19

1 Answers1

4

Try out as

 arcLayout.setArc(0.0f, 360.0f); 

EDITED:

There is no use of your below code:

    ArcLayout arcLayout= new ArcLayout(this);
    arcLayout.setChildSize(50);
    arcLayout.setArc(0.0f, 300.0f); 

You just change your layout code as below and then check

   <com.capricorn.ArcMenu
        android:id="@+id/arc_menu_2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        arc:fromDegrees="0.0"
        arc:toDegrees="360.0"
        arc:childSize="50dp"/>
GrIsHu
  • 29,068
  • 10
  • 64
  • 102
  • Thanks for replay bro but i want like [link](https://dl.dropbox.com/u/11369687/preview1.png) – Kuldeep Mar 04 '14 at 06:48
  • That is what i did You have to define to degree and from degree from 0.0 to 360.0 to get circular layout. – GrIsHu Mar 04 '14 at 06:58
  • @user3145614 Check out my updated answer. Actually you are not at all setting the degrees in your ArcMenu. That is why its not showing you the result. You are just changing into `ArcLayout` not in `ArcMenu`. FYI `ArcLayout` is used to create dynamice `ArcLayout` and inside that `ArcMenu` is created. – GrIsHu Mar 04 '14 at 07:05