android环形控件,基于Material Design设计的环形菜单控件

本文介绍了如何在Android应用中使用AnnularMenu库创建环形菜单,包括XML布局和Java代码的详细用法。该库基于Material Design设计,支持设置菜单位置、半径、动画时长及阴影效果。通过提供的示例代码,开发者可以快速理解和集成环形菜单到自己的项目中。
摘要由CSDN通过智能技术生成

title.png

AnnularMenu is based on Material Design design of the ring menu control. For specific use, please read down.

demo3.gif

b62559eb9d7e93af4943c1061a8fe04b.gif    3c415621f5d8631f1ec035f5cb8bb6c4.gif

Usage

In the module build.gradle

com.dingmouren.annularmenu:annularmenu:1.0.2

Example Usage

1.Layout XML

xmlns:app="http://schemas.android.com/apk/res-auto"

android:orientation="vertical"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:position="left_bottom" //The menu's location

app:radius="120dp" //The radius of the menu

app:toggleDuration="500" //Open / close the menu duration of the animation

>

android:layout_width="60dp"

android:layout_height="60dp"

android:layout_centerHorizontal="true"

app:src="@mipmap/menu" //The first is the button that opens or closes the menu

app:shadowOffsetX="2dp" //The shadow of the offset in the direction of X

app:shadowOffsetY="2dp" //The offset of the shadow in the Y direction

app:shadowRadius="5dp" //Shadow radius

/>

android:layout_width="45dp"

android:layout_height="45dp"

android:layout_centerHorizontal="true"

app:src="@mipmap/item1" //The following are the item menu

app:shadowOffsetX="2dp"

app:shadowOffsetY="2dp"

app:shadowRadius="2dp"

/>

...

2.Java code

menu1.setOnMenuItemClickListener(new AnnularMenu.OnMenuItemClickListener() {

@Override

public void onClick(View view, int position) {

}

});

Attribute

AnnularMenu

Description

position

The menu's location, values are: left_top, left_bottom, right_top, right_bottom, and the default is right_bottom

radius

The radius of the menu, when the number of item items in the menu increases, you need to set the radius to adjust the item spacing

toggleDuration

Open / close the menu duration of the animation, the default is 500 milliseconds

ShadowImageView

Description

shadowOffsetX

The shadow of the offset in the direction of X

shadowOffsetY

The offset of the shadow in the Y direction

shadowRadius

Shadow radius

src

picture

AnnularMenu’Method

AnnularMenu

Description

public boolean isOpen()

Determines whether the menu is open or closed at the moment

public void toggle()

Switch menu

public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener)

Listen for the click of the menu item item

public void setMenuButtonClickable(boolean clickable)

Change the menu button clickable state

Welcome to make suggestions

License

Copyright (C) 2017

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值