Android 悬浮菜单(按钮) BoomMenu(样式大合集)

本文详细介绍BoomMenu在Android应用中的多样化样式展示,包括如何在XML中配置BoomMenuButton,以及通过代码逻辑实现各种动画效果和自定义设置。BoomMenu提供丰富的样式选择,适用于不同场景需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android 悬浮菜单 BoomMenu(样式大合集)

 

一、样式大集合:(总有一款适合你)

 

 

BoomMenu 使用

一、Demo 效果演示:


二、导入引用

dependencies {
…
compile ‘com.nightonke:boommenu:x.y.z’
…
}

//x.y.z 为最新jar版本 
// https://github.com/Nightonke/BoomMenu


二、xml中添加布局

<com.nightonke.boommenu.BoomMenuButton
android:id=”@+id/boom”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_alignParentBottom=”true”
android:layout_alignParentRight=”true”
android:layout_alignParentEnd=”true”
android:layout_margin=”20dp”
app:boom_inActionBar=”false”
app:boom_button_color=”@color/colorPrimary”
app:boom_button_pressed_color=”@color/colorPrimary”
/>

 

三、代码逻辑

boomMenuButton = (BoomMenuButton)findViewById(R.id.boom);

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);

    boomMenuButton.init(
        subButtonDrawables, // 子按钮图片数组。不能空。
        subButtonTexts,     // 子按钮的文本数组,可以为空。
        subButtonColors,    // 子按钮的颜色数组,包括按下状态和正常状态。
        ButtonType.HAM,     // 按钮类型。
        BoomType.PARABOLA,  // The boom type.
        PlaceType.HAM_3_1,  // The place type.
        null,               // Ease type to move the sub buttons when showing.
        null,               // Ease type to scale the sub buttons when showing.
        null,               // Ease type to rotate the sub buttons when showing.
        null,               // Ease type to move the sub buttons when dismissing.
        null,               // Ease type to scale the sub buttons when dismissing.
        null,               // Ease type to rotate the sub buttons when dismissing.
        null                // Rotation degree.
    ); 
}

 

相关属性 详细参数 请查看源码:
https://github.com/Nightonke/BoomMenu

 

 

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);     } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值