FloatMenuSampleAndroid 悬浮窗菜单
Android 悬浮窗菜单,可在launcher或app中使用。
示例代码:
@Override public void onCreate() { super.onCreate(); mFloatMenu = new FloatMenu.Builder(this) .floatLoader(R.drawable.yw_anim_background) .floatLogo(R.drawable.yw_image_float_logo) .addMenuItem(android.R.color.transparent, R.drawable.yw_menu_account, Const.MENU_ITEMS[0], android.R.color.black, this) .addMenuItem(android.R.color.transparent, R.drawable.yw_menu_favour, Const.MENU_ITEMS[1], android.R.color.black, this) .addMenuItem(android.R.color.transparent, R.drawable.yw_menu_fb, Const.MENU_ITEMS[2], android.R.color.black, this) .addMenuItem(android.R.color.transparent, R.drawable.yw_menu_msg, Const.MENU_ITEMS[3], android.R.color.black, this) .addMenuItem(android.R.color.transparent, R.drawable.yw_menu_close, Const.MENU_ITEMS[4], android.R.color.black, this) .menuBackground(R.drawable.yw_menu_bg) .onMenuActionListner(this) .build(); mFloatMenu.show(); } public void showFloat() { if (mFloatMenu != null) mFloatMenu.show(); } public void hideFloat() { if (mFloatMenu != null) { mFloatMenu.hide(); } } public void destroyFloat() { hideFloat(); if (mFloatMenu != null) { mFloatMenu.destroy(); } mFloatMenu = null; } private void showRed() { if (!hasNewMsg) { mFloatMenu.changeLogo(R.drawable.yw_image_float_logo, R.drawable.yw_menu_msg, 3); } else { mFloatMenu.changeLogo(R.drawable.yw_image_float_logo_red, R.drawable.yw_menu_msg_red, 3); } }
评论