SpringActionMenu

介绍:

一个弹性的功能菜单

运行效果:

使用说明:

详细介绍见:手把手教你绘制Android粘性果冻动画组件 

  安装

  • gradle

  • Step 1. Add the JitPack repository to your build file
    allprojects {
        repositories {
            jcenter()
            maven { url "https://jitpack.io" }
        }
    }
    
  •  Step 2. Add the dependency
    dependencies {
                compile 'com.github.lilei644:SpringActionMenu:1.0.0'
    }
    

xml初始化

<com.lilei.springactionmenu.ActionMenu
        android:id="@+id/actionMenu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="20dp"
        app:circleRadius="25dp"
        app:dimens="10dp"
        app:animationDuration="2500"
        app:expandDirect="expandDirectTop"
        app:buttonNormalColor="#ff5bc0de"
        app:buttonPressColor="#ff39b3d7"
        app:actionMenuIcon="@drawable/add"
        app:actionMenuOnIcon="@drawable/close"
        />

add menu items   添加菜单组件添加菜单组件添加

ActionMenu actionMenu = (ActionMenu) findViewById(R.id.actionMenu);
// add menu items
actionMenu.addView(R.drawable.search, getItemColor(R.color.menuNormalInfo), getItemColor(R.color.menuPressInfo));
actionMenu.addView(R.drawable.like, getItemColor(R.color.menuNormalRed), getItemColor(R.color.menuPressRed));
actionMenu.addView(R.drawable.write);

delegate  代理监听

actionMenu.setItemClickListener(new OnActionItemClickListener() {
    @Override
    public void onItemClick(int index) {
    }
    @Override
    public void onAnimationEnd(boolean isOpen) {
    }
});

attr property   属性

nameformatdescriptiondefault
circleRadiusdimensionRound menu radius30
dimensdimensionThe spacing of the menu items30
animationDurationintegerAnimation duration500
buttonNormalColorcolorButton The color in normal conditionColor.RED
buttonPressColorcolorThe color of the button click statusColor.RED
actionMenuIconreferenceMenu icon--
actionMenuOnIconreferenceThe icon when the menu is open--
expandDirectenumThe direction of the menu extensionexpandDirectTop

Requirements  版本要求

Android 14+

已下载
0