CircularFloatingActionMenu实现扇形的悬浮菜单

github地址:https://github.com/oguzbilgener/CircularFloatingActionMenu


依赖包:

dependencies {
    compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
}

效果图:


1 -创建一个按钮来附加菜单:

// in Activity Context
ImageView icon = new ImageView(this); // Create an icon
icon.setImageDrawable( ... );
	
FloatingActionButton actionButton = new FloatingActionButton.Builder(this)
										.setContentView(icon)
										.build();

2 - 创建菜单项:

SubActionButton.Builder itemBuilder = new SubActionButton.Builder(this);
// repeat many times:
ImageView itemIcon = new ImageView(this);
itemIcon.setImageDrawable( ... ); 
SubActionButton button1 = itemBuilder.setContentView(itemIcon).build();
 

3 - 用项目创建菜单:

FloatingActionMenu actionMenu = new FloatingActionMenu.Builder(this)
									.addSubActionView(button1)
									.addSubActionView(button2)
									// ...
									.attachTo(actionButton)
									.build();

你可能感兴趣的:(Androidのdemo)