android xmenu 点击,android炫酷的导航栏效果

先放效果图

2cca222f6d8b44b028da7b0ae40f7bfb.png

menu.gif

按钮的图片和颜色可自定义。

可以设置点击事件

这么炫酷的效果怎么实现呢? 只需3步!

How to use

Step1

引入依赖

allprojec

ts {

repositories {

...

maven { url 'https://jitpack.io' }

}

}

dependencies {

compile 'com.github.monkeywiiu:Xmenu:v5'

}

Step2

使用自定义控件(其实就是一个RelativeLayout)

just like RelativeLayout

Step3

//设置图片和颜色

PUtils.getInstance().setImagesAndColors(ListimageList, ListcolorList);

//设置是否可见,默认是不可见

PUtils.getInstance().setVisible(true);

//设置悬浮按钮的margin

PUtils.getInstance().setMargin((int) getResources().getDimension(R.dimen.marginRight),

(int) getResources().getDimension(R.dimen.marginBottom));

setContentView(R.layout.activity_main);

需要在 setContentView(..)之前设置图片和颜色

设置按钮的点击事件

container.setIsClickable(true); //默认是false

container = (SnakeButtonLayout) findViewById(R.id.container);

container.setOnTopViewClickListener(new SnakeButtonLayout.onTopViewClickListener() {

@Override

public void onclick() {

Toast.makeText(MainActivity.this, "你点击了导航栏", Toast.LENGTH_SHORT).show();

}

});

github地址:https://github.com/monkeywiiu/Xmenu

喜欢记得star一下呗

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值