Don't say much nonsense, look first:
<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" match_parent "> <Rela Tivelayout android:id= "@+id/level1" android:layout_width= "100DP" android:layout_height= "50DP" Android:layout_alignparentbottom= "true" android:layout_centerhorizontal= "true" android:background= "@drawable /level1 "> <imageview android:id=" @+id/icon_home "android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:layout_centerinparent= "true" Android:backgrou nd= "@drawable/icon_home"/> </RelativeLayout> <relativelayout android:id= "@+id/level2" and Roid:layout_width= "180DP" android:layout_height= "90DP" android:layout_alignparentbottom= "true" Androi D:layout_centerhorizontal= "true" Android:background= "@drawable/level2" > <imageview android:id= "@+id/icon_search" Android:lay Out_width= "Wrap_content" android:layout_height= "Wrap_content" android:layout_alignparentbottom= "true "Android:layout_alignparentleft=" true "android:layout_marginbottom=" 10DP "android:layout _marginleft= "10DP" android:background= "@drawable/icon_search"/> <imageview android:id= "@+id/icon_menu" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:layout_centerhorizontal= "true" android:layout_margintop= "5DP" android:background= "@drawable /icon_menu "/> <imageview android:id=" @+id/icon_myyouku "android:layout_width=" Wrap_con Tent "android:layout_height=" Wrap_content "android:layout_alignparentbottom=" true "Androi D:layout_alignparentrighT= "true" android:layout_marginbottom= "10DP" android:layout_marginright= "10DP" Android:bac kground= "@drawable/icon_myyouku"/> </RelativeLayout> <relativelayout android:id= "@+id/level3" Android:layout_width= "280DP" android:layout_height= "140DP" android:layout_alignparentbottom= "true" Android:layout_centerhorizontal= "true" android:background= "@drawable/level3" > <imageview Android:id= "@+id/channel1" android:layout_width= "wrap_content" android:layout_height= "wrap_content "Android:layout_alignparentbottom=" true "android:layout_alignparentleft=" true "android:l Ayout_marginbottom= "10DP" android:layout_marginleft= "10DP" android:background= "@drawable/channel1"/ > <imageview android:id= "@+id/channel2" android:layout_width= "Wrap_content" Android:layout_height= "WRap_content "android:layout_above=" @id/channel1 "android:layout_alignleft=" @id/channel1 " Android:layout_marginbottom= "10DP" android:layout_marginleft= "20DP" android:background= "@drawable/ch Annel2 "/> <imageview android:id=" @+id/channel3 "android:layout_width=" Wrap_content " android:layout_height= "Wrap_content" android:layout_above= "@id/channel2" Android:layout_ali gnleft= "@id/channel2" android:layout_marginbottom= "5DP" android:layout_marginleft= "30DP" android:background= "@drawable/channel3"/> <imageview android:id= "@+id/channel4" Androi D:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:layout_centerhorizontal= " True "android:layout_margintop=" 10DP "android:background=" @drawable/channel4 "/> <image View android:Id= "@+id/channel7" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android:layout_alignparentbottom= "true" android:layout_alignparentright= "true" Android:layout_mar Ginbottom= "10DP" android:layout_marginright= "10DP" android:background= "@drawable/channel7"/> <imageview android:id= "@+id/channel6" android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:layout_above= "@id/channel7" android:layout_alignright= " @id/channel7 "android:layout_marginbottom=" 10DP "android:layout_marginright=" 20DP "Androi d:background= "@drawable/channel6"/> <imageview android:id= "@+id/channel5" Android Oid:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_above= "@id/chann El6 "Android:layout_alignright= "@id/channel6" android:layout_marginbottom= "5DP" android:layout_marginright= "30DP" android:background= "@drawable/channel5"/> </RelativeLayout></RelativeLayout>
Package Com.example.circlemenuofbottom.anim;import Android.view.animation.rotateanimation;import android.widget.relativelayout;/** * @author LZD * * qq:2622596982 * * Email: [email protected] * * QQ Group: 27759 9214 */public class Myanimationutils {/** * out animation---clockwise out * * @param view * Animate object */public static void Animao UT (relativelayout view) {/* * rotateanimation animation = new Rotateanimation (0,, * view.getwidth ()/2, View.getheigh T ()); Animation.setduration (500); * Animation.setfillafter (TRUE); View.startanimation (animation); */animaout (view, 0);} /** * Go out of the animation---counterclockwise * * @param view * Animate object */public static void Animain (Relativelayout view) {/* *//clockwise in/ /Rotateanimation animation = new Rotateanimation (In//* 360,view.getwidth ()/2, View.getheight ()); Counterclockwise into rotateanimation * animation = new Rotateanimation ( -180, -360, View.getwidth ()/* 2,view.getheight ()); Animation.setduration (500); * Animation.setfillafter (TRUE); View.startanimation (ANimation); */animain (view, 0);} /** * out of animation---clockwise out * * @param view * Animate object * @param offsettime * Time delay execution */public static void Ani Maout (relativelayout view, int offsettime) {rotateanimation animation = new Rotateanimation (0, 180,view.getwidth ()/2, VI Ew.getheight ()); animation.setduration (+); Animation.setstartoffset (offsettime); Animation.setfillafter (true); View.startanimation (animation);} public static void Animain (relativelayout view, int offsettime) {//clockwise in//Rotateanimation animation = new Rotateanimation (180,//360,view.getwidth ()/2, View.getheight ());//Counter-clockwise rotateanimation animation = new Rotateanimation (-180,-360, View.getwidth ()/2, View.getheight ()); animation.setduration; Animation.setstartoffset (offsettime); Animation.setfillafter (True); view.startanimation (animation);}}
Key processing ideas:
/* * Listening Menu key, when the user click on the menu key, show and hide the first level and level two menu * * Monitor the return key, and then press exit program */private long exittime = 0; @Overridepublic boolean onKeyDown (int KeyCode, KeyEvent event) {//Menu key Processing if (event.getaction () = = Keyevent.action_down && keycode = keyevent.keycode_m ENU) {//If the first-level menu is displayed, hide all if (IsShowLevel1) {myanimationutils.animaout (levels); IsShowLevel1 = False;if (IsShowLevel2) { Myanimationutils.animaout (level2,120); IsShowLevel2 = False;if (isShowLevel3) {myanimationutils.animaout (level3,120 ); isShowLevel3 = false;}}} else{//if the first level menu-style hidden, show A, level two menu myanimationutils.animain; Myanimationutils.animain (level2); isShowLevel1 = True;isshowlevel2 = true;}} Return key if (event.getaction () = = Keyevent.action_down && keycode = = keyevent.keycode_back) {if ( System.currenttimemillis ()-exittime > () {toast.maketext (this, "Press the Return key again", Toast.length_short). Show (); Exittime = System.currenttimemillis ();} Else{finish (); System.exit (0);} return true;} Return Super.onkeydown (KeyCode, event);}
There is nothing to say, take a closer look on the full understanding, if there are questions, please contact me or to the group to communicate.
Last attached: http://download.csdn.net/detail/escdelete/8340545
Android Ring Menu (Processed menu key and return key + added animation)