Android-satellite-menu Implementation Click the Main button, will pop up a plurality of buttons arranged around the main button, thus forming a satellite pop-up menu. The animation of the child buttons popping up and disappearing is great. This pop-up menu button is applied in Path2.0.
Usage
in your V Add a component definition to the Iew XML, as shown in the following example:
<?xml version= "1.0" encoding= "Utf-8"? ><framelayout xmlns:android= "http// Schemas.android.com/apk/res/android " xmlns:sat=" http://schemas.android.com/apk/res/ Android.view.ext " android:layout_width=" Fill_parent " android: layout_height= "fill_parent" android:orientation= "vertical" > <android.view.ext.satellitemenu android:id= "@+id/menu" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" Android:layout_gravity= "Bottom|left" android:layout_margin= "8DP " sat:satellitedistance=" 170DP " sat:mainimaGe= "@drawable/ic_launcher" " sat:totalspacingdegree=" sat:closeonclick= "true" sat:expandduration= "/> </framelayout>"
properties are:
- Satellitedistance the distance of items from the center button
- Totalspacingdegree the degree between the first and the last item.
- Closeonclick defines if the menu shall collapse after clicking on a menu item.
- Expandduration the duration of expand and collapse operations in milliseconds.
After your view XML definition, you can add a submenu by following this code:
Satellitemenu menu = (satellitemenu) Findviewbyid (R.id.menu); list<satellitemenuitem> items = new arraylist<satellitemenuitem> (); Items.Add (New Satellitemenuitem (4, r.drawable.ic_1)); Items.Add (New Satellitemenuitem (4, r.drawable.ic_3)); Items.Add (New Satellitemenuitem (4, R.drawable.ic_4)); Items.Add (New Satellitemenuitem (3, R.drawable.ic_5)); Items.Add (New Satellitemenuitem (2, R.drawable.ic_6)); Items.Add (New Satellitemenuitem (1, r.drawable.ic_2));
Each menu item takes the ID of the item and the Drawable resource for the item.
In order to listen clicks on items:
Menu.setonitemclickedlistener (New Sateliteclickedlistener () {public void eventoccured (int id) { log.i ("sat" , "Clicked on" + ID); });
Project homepage:http://www.open-open.com/lib/view/home/1390737573132
Android Satellite Menu: Android-satellite-menu