android button menu,GitHub - tuenti/ButtonMenu: ButtonMenu is an Android library created to build us...

本文介绍了一个名为ButtonMenu的Android库,它使用MVVM模式和自定义LinearLayout子类创建用户界面。库中包含ButtonMenu视图和ScrollAnimator动画,用于与ListView联动显示和隐藏。适用于Android 2.x及更高版本,提供SimpleButtonMenuVM示例和自定义选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Button Menu 68747470733a2f2f7472617669732d63692e6f72672f7475656e74692f427574746f6e4d656e752e7376673f6272616e63683d6d617374657268747470733a2f2f6d6176656e2d6261646765732e6865726f6b756170702e636f6d2f6d6176656e2d63656e7472616c2f636f6d2e7475656e74692e627574746f6e6d656e752f6c6962726172792f62616467652e73766768747470733a2f2f696d672e736869656c64732e696f2f62616467652f416e64726f6964253230417273656e616c2d427574746f6e2532304d656e752d627269676874677265656e2e7376673f7374796c653d666c6174

ButtonMenu is an Android library created to build user interfaces based on buttons. This library has been implemented

using Model View ViewModel pattern combined with an Android custom view that extends LinearLayout.

In this library you will find a custom view implementation called ButtonMenu and a custom animator called

ScrollAnimator you can use to link the scroll of a ListView with your ButtonMenu to show or hide the view when the

user uses the ListView scroll.

This library works on Android 2.X or higher versions.

Screenshots

screenshot1.gif

screenshot2.gif

Download

Download the project, compile it using mvn clean install import buttonmenu-1.0.9.jar into your project.

Or declare it into your pom.xml

com.tuenti.buttonmenu

library

1.0.9

Or into your build.gradle

dependencies{

compile 'com.tuenti.buttonmenu:library:1.0.9'

}

Usage

Add a ButtonMenu to your layout.

android:id="@+id/button_menu"

style="@style/button_menu"/>

Initialize your ButtonMenu widget with a ButtonMenuVM implementation inside your Activity or Fragment. You can use

our SimpleButtonMenuVM implementation or create your own ButtonMenuVM implementation.

private void initializeButtonMenu() {

button_menu = (ButtonMenu) findViewById(R.id.button_menu);

button_menu.setButtonMenuVM(buttonMenuVM);

button_menu.initialize();

}

If you want to create your custom ButtonMenuVM implementation you can follow the sample implemented in

CustomButtonMenuVM.

public class CustomButtonMenuVM extends SimpleButtonMenuVM {

/*

* Every ButtonVM implementation could be moved to a different file extending SimpleButtonVM if needed.

*/

private final ButtonVM moment = new SimpleButtonVM(R.layout.moment_button, R.id.moment, null);

private final ButtonVM photo = new SimpleButtonVM(R.layout.photo_button, R.id.photo, null);

private final ButtonVM contact = new SimpleButtonVM(R.layout.contact_button, R.id.contact, null);

public CustomButtonMenuVM() {

super();

addItem(moment);

addItem(photo);

addItem(contact);

}

Connect your ButtonMenu widget with the ScrollAnimator to attach the scroll animation effect.

private void initializeScrollAnimator() {

ScrollAnimator scrollAnimator = new ScrollAnimator(button_menu, new ObjectAnimatorFactory());

scrollAnimator.configureListView(lv_contacts);

scrollAnimator.setDurationInMillis(300);

}

Review different ButtonVM implementations -like SimpleButtonVM or ButtonWithMutableSubjectVM - in this

project if you want to create your custom ButtonVM.

Credits & Contact

ButtonMenu was created by Android team at Tuenti Technologies S.L.. You can follow Tuenti

engineering team on Twitter @tuentieng.

License

ButtonMenu is available under the Apache License, Version 2.0. See LICENSE.txt file for more info.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值