AllAngleExpandableButton

AllAngleExpandableButton

项目地址: AllAngleExpandableButton
简介:任意角度可扩展的 button menu

An button menu that can expand from any angle to any angle as you like.
It support two type of button, text button and icon button.You can define the button style as you like, such as button size, button background color, text size, button shadow and so on.

screenshot

Add to your project

  • step1:Add it in your root build.gradle at the end of repositories:
      allprojects {
          repositories {
              ...
              maven { url "https://jitpack.io" }
          }
      }
    
  • step2:Add the dependency:
      dependencies {
          compile 'com.github.uin3566:AllAngleExpandableButton:v1.0.0'
      }
    

Usage

Declare an AllAngleExpandableButton inside your XML file as show below, but note that the layout_width and layout_height is useless, the size of AllAngleExpandableButton is decided by aebMainButtonSizeDp and aebButtonElevation together at last.

<com.fangxu.allangleexpandablebutton.AllAngleExpandableButton
    android:id="@+id/button_expandable"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="100dp"
    app:aebAnimDurationMillis="175"
    app:aebButtonElevation="4dp"
    app:aebButtonGapDp="25dp"
    app:aebEndAngleDegree="90"
    app:aebIsSelectionMode="false"
    app:aebMainButtonRotateAnimDurationMillis="250"
    app:aebMainButtonRotateDegree="-135"
    app:aebMainButtonSizeDp="56dp"
    app:aebMainButtonTextColor="#ffff5656"
    app:aebMainButtonTextSizeSp="20dp"
    app:aebMaskBackgroundColor="@color/blue"
    app:aebRippleColor="@color/red"
    app:aebRippleEffect="true"
    app:aebStartAngleDegree="90"
    app:aebSubButtonSizeDp="56dp"
    app:aebSubButtonTextColor="#ff0000ff"
    app:aebSubButtonTextSizeSp="18dp"/>

use AllAngleExpandableButton in java code like this:

  • step1: define an ArrayList to store button infos and set the list to AllAngleExpandableButton
      AllAngleExpandableButton button = (AllAngleExpandableButton)findViewById(R.id.button_expandable);
      final List<ButtonData> buttonDatas = new ArrayList<>();
      int[] drawable = {R.drawable.plus, R.drawable.mark, R.drawable.settings, R.drawable.heart};
      for (int i = 0; i < drawable.length; i++) {
          ButtonData buttonData = ButtonData.buildIconButton(context, drawable[i], 0);
          buttonDatas.add(buttonData);
      }
      button.setButtonDatas(buttonDatas);
    
  • step2: add listener to AllAngleExpandableButton

      button.setButtonEventListener(new ButtonEventListener() {
          @Override
          public void onButtonClicked(int index) {
              //do whatever you want,the param index is counted from startAngle to endAngle,  
              //the value is from 1 to buttonCount - 1(buttonCount if aebIsSelectionMode=true)
          }
    
          @Override
          public void onExpand() {
    
          }
    
          @Override
          public void onCollapse() {
    
          }
      });
    

Attributes

all of the attributes are listed below:

attributevalue typedefalut valuedescription
aebStartAngleDegreeinteger90the start angle of the expand buttons
aebEndAngleDegreeinteger90the end angle of the expand buttons
aebMaskBackgroundColorcolorColor.TRANSPARENTthe fullscreen background color when the buttons are expanded
aebIsSelectionModebooleanfalseif true,when a sub button is selected,the main button is setted as the selected sub button
aebAnimDurationMillisinteger225expand and collapse animator duration in time milliseconds.
aebMainButtonRotateAnimDurationMillisinteger300the main button rotate animator duration in time milliseconds
aebMainButtonRotateDegreeinteger0main button rotate degree while expanding
aebButtonElevationdimen4dpused for draw the button shadow.
aebRippleEffectbooleantrueripple effect on main button when it's touched
aebRippleColorcolordepends on button backgroundripple effect color, default is the light color of the button background
aebMainButtonSizeDpdimen60the size of the main button
aebMainButtonTextSizeSpdimen20the size of the main button text
aebMainButtonTextColorcolorColor.BLACKthe color of the main button text
aebSubButtonSizeDpdimen60the size of the sub button
aebSubButtonTextSizeSpdimen20the size of the sub button text
aebSubButtonTextColorcolorColor.BLACKthe color of the sub button text
aebButtonGapDpdimen50dpthe distance of main button and sub button.

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值