android 弹出菜单代码,Android 菜单BoomMenu(悬浮按钮弹出菜单)

ecffd6c4c73109ba1f37483feb243fe0.png

1bf28c1740b7d66c933906a476a6fb2f.png

76a69ad87a2c3d62261a1b4e3d5ff032.png

BoomMenu实现

一、导入jar

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:[email protected]/colorPrimary”

app:[email protected]/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.

);

}

部分参数设置demo图展示

6a807799285b62757c6bf2b0b97be58f.png

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值