Convert Figma logo to code with AI

michaldrabik logoTapBarMenu

Tap Bar Menu

1,017
136
1,017
4

Top Related Projects

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion

Side menu with some categories to choose.

You can easily add awesome animated context menu to your app.

A menu which can ... BOOM! - Android

Quick Overview

TapBarMenu is an Android library that provides a customizable, animated menu for bottom navigation. It offers a unique and visually appealing alternative to standard bottom navigation bars, featuring smooth animations and a circular reveal effect when tapped.

Pros

  • Visually appealing and unique design
  • Smooth animations for enhanced user experience
  • Highly customizable in terms of colors, icons, and behavior
  • Easy to integrate into existing Android projects

Cons

  • Limited to a maximum of 3 menu items
  • May not be suitable for apps requiring more complex navigation structures
  • Requires custom implementation for landscape orientation
  • Potential learning curve for developers unfamiliar with custom views

Code Examples

  1. Basic implementation in an Activity:
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val tapBarMenu = findViewById<TapBarMenu>(R.id.tapBarMenu)
        tapBarMenu.setOnClickListener {
            tapBarMenu.toggle()
        }
    }
}
  1. Customizing menu item click listeners:
tapBarMenu.setOnItemClickListener { view, position ->
    when (position) {
        0 -> // Handle first item click
        1 -> // Handle second item click
        2 -> // Handle third item click
    }
}
  1. Programmatically changing menu colors:
tapBarMenu.apply {
    setMenuButtonColor(ContextCompat.getColor(context, R.color.menu_button_color))
    setMenuBackgroundColor(ContextCompat.getColor(context, R.color.menu_background_color))
    setButtonPosition(TapBarMenu.BUTTON_POSITION_CENTER)
}

Getting Started

  1. Add the JitPack repository to your project's build.gradle:
allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
  1. Add the dependency to your app's build.gradle:
dependencies {
    implementation 'com.github.michaldrabik:tapbarmenu:1.0.6'
}
  1. Add the TapBarMenu view to your layout XML:
<com.michaldrabik.tapbarmenu.TapBarMenu
    android:id="@+id/tapBarMenu"
    android:layout_width="match_parent"
    android:layout_height="56dp"
    android:layout_gravity="bottom"
    app:tbm_backgroundColor="@color/colorPrimary"
    app:tbm_buttonPosition="center"
    app:tbm_menuAnchor="bottom">

    <ImageView
        style="@style/TapBarMenuImageItem"
        android:src="@drawable/ic_person" />

    <ImageView
        style="@style/TapBarMenuImageItem"
        android:src="@drawable/ic_search" />

    <ImageView
        style="@style/TapBarMenuImageItem"
        android:src="@drawable/ic_settings" />

</com.michaldrabik.tapbarmenu.TapBarMenu>
  1. Initialize and customize the TapBarMenu in your Activity or Fragment as shown in the code examples above.

Competitor Comparisons

Pros of bubble-icon-tabbar

  • More visually appealing with animated bubble effect
  • Supports both icon and text labels for tab items
  • Customizable appearance with various style options

Cons of bubble-icon-tabbar

  • More complex implementation due to advanced animations
  • Potentially higher performance overhead
  • Limited documentation and examples

Code Comparison

TapBarMenu:

val tapBarMenu = TapBarMenu(context)
tapBarMenu.setItems(R.menu.menu_items)
tapBarMenu.setOnItemSelectedListener { item ->
    // Handle item selection
}

bubble-icon-tabbar:

let tabBar = BubbleTabBar()
tabBar.dataSource = self
tabBar.delegate = self
tabBar.configure(withImages: [UIImage(named: "home")!, ...])

Summary

TapBarMenu offers a simpler implementation with a focus on a compact, expandable menu design. It's easier to set up but has fewer customization options. bubble-icon-tabbar provides a more visually striking interface with animated bubbles and supports both icons and text labels. However, it requires more complex setup and may have higher performance costs. TapBarMenu is implemented in Kotlin for Android, while bubble-icon-tabbar is written in Swift for iOS, which may influence the choice depending on the target platform.

:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion

Pros of animated-tab-bar

  • More extensive customization options for animations and icons
  • Supports both Swift and Objective-C
  • Larger community and more frequent updates

Cons of animated-tab-bar

  • More complex implementation due to additional features
  • Larger file size and potential performance impact
  • Steeper learning curve for developers

Code Comparison

TapBarMenu:

let tapBarMenu = TapBarMenu(items: ["Home", "Search", "Profile"])
tapBarMenu.delegate = self
view.addSubview(tapBarMenu)

animated-tab-bar:

let tabBar = RAMAnimatedTabBarController()
tabBar.viewControllers = [homeVC, searchVC, profileVC]
tabBar.animationControllerForTransition = RAMFlipLeftTransitionItemAnimations()

Both libraries offer easy-to-use tab bar implementations, but animated-tab-bar provides more advanced animation options at the cost of increased complexity. TapBarMenu is simpler and more lightweight, making it suitable for projects that require basic functionality. animated-tab-bar is better suited for apps that need highly customized and visually appealing tab bar animations.

Side menu with some categories to choose.

Pros of Side-Menu.Android

  • More comprehensive and feature-rich side menu implementation
  • Offers customizable animations and transitions
  • Provides a full-screen menu experience

Cons of Side-Menu.Android

  • Larger library size and potentially more complex integration
  • May require more setup and configuration
  • Less suitable for simple bottom navigation scenarios

Code Comparison

TapBarMenu:

tapBarMenu.setOnClickListener {
    tapBarMenu.toggle()
}

Side-Menu.Android:

val screenShotable = ScreenShotable()
resideMenu = ResideMenu(this)
resideMenu.attachToActivity(this)
resideMenu.setMenuListener(menuListener)
resideMenu.setScaleValue(0.6f)

The TapBarMenu code snippet shows a simple toggle action, while Side-Menu.Android requires more setup, including creating a ScreenShotable object, attaching the menu to an activity, and configuring various properties.

Side-Menu.Android offers more customization options but requires more code to implement. TapBarMenu provides a simpler, more straightforward implementation for basic menu functionality.

You can easily add awesome animated context menu to your app.

Pros of Context-Menu.Android

  • More customizable with various animation options and styles
  • Supports both vertical and horizontal menu layouts
  • Larger community and more frequent updates

Cons of Context-Menu.Android

  • More complex implementation and setup
  • Larger library size, potentially impacting app performance
  • Steeper learning curve for developers

Code Comparison

TapBarMenu:

tapBarMenu.setOnClickListener {
    tapBarMenu.toggle()
}

Context-Menu.Android:

val menuParams = MenuParams()
menuParams.actionBarSize = resources.getDimension(R.dimen.tool_bar_height).toInt()
menuParams.menuObjects = getMenuObjects()
menuParams.isClosableOutside = false
mMenuDialogFragment = ContextMenuDialogFragment.newInstance(menuParams)

The TapBarMenu implementation is simpler and more straightforward, while Context-Menu.Android offers more customization options but requires more setup code.

Both libraries provide unique menu solutions for Android applications, with TapBarMenu focusing on simplicity and ease of use, while Context-Menu.Android offers more advanced features and customization options at the cost of increased complexity.

A menu which can ... BOOM! - Android

Pros of BoomMenu

  • More customizable with various animation styles and button types
  • Supports multiple buttons (up to 9) in a circular or ham layout
  • Offers extensive documentation and examples

Cons of BoomMenu

  • More complex implementation due to increased customization options
  • Larger library size, potentially impacting app performance
  • Steeper learning curve for developers

Code Comparison

TapBarMenu:

tapBarMenu.setOnClickListener {
    tapBarMenu.toggle()
}

BoomMenu:

BoomMenuButton bmb = findViewById(R.id.bmb);
bmb.addBuilder(new HamButton.Builder()
    .normalImageRes(R.drawable.icon)
    .normalText("Text"));

Key Differences

  • TapBarMenu focuses on a simple, animated menu with limited options
  • BoomMenu offers more complex animations and button configurations
  • TapBarMenu is implemented in Kotlin, while BoomMenu uses Java
  • BoomMenu has more active development and community support

Use Cases

  • TapBarMenu: Ideal for simple, quick-access menus with minimal customization
  • BoomMenu: Suitable for apps requiring elaborate menu designs and animations

Both libraries provide unique menu solutions for Android apps, with TapBarMenu offering simplicity and BoomMenu providing extensive customization options.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Android Arsenal Platform API

TapBar Menu

Simple library that helps creating a "Tap Bar" menu layout.

alt text alt text

Demo 1: https://youtu.be/DjY0cTWWtao

Demo 2: https://youtu.be/dWuPMN6WTOY

Install

Since version 1.0.6 this library is being distributed via JitPack

Step 1:
Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2:
Add the dependency:

dependencies {
	implementation 'com.github.michaldrabik:TapBarMenu:1.0.6'
}

For versions 1.0.5 and older:

Add the dependency to your build.gradle:

dependencies {
    compile 'com.github.michaldrabik:tapbarmenu:1.0.5'
}

Use

Check sample project for a full example.

TapBarMenu is an extension of a LinearLayout so you can simply put it in your XML. For example:

<com.michaldrabik.tapbarmenulib.TapBarMenu
  android:id="@+id/tapBarMenu"
  android:layout_width="match_parent"
  android:layout_height="56dp"
  android:layout_gravity="bottom"
  android:layout_marginBottom="24dp"
  >
  
    <ImageView
      android:id="@+id/item1"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:paddingTop="10dp"
      android:paddingBottom="10dp"
      android:src="@drawable/ic_thumb_up"
      />
  
    <Space
      android:layout_width="56dp"
      android:layout_height="match_parent"
      />
  
    <ImageView
      android:id="@+id/item2"
      android:layout_width="0dp"
      android:layout_height="wrap_content"
      android:layout_weight="1"
      android:paddingTop="10dp"
      android:paddingBottom="10dp"
      android:src="@drawable/ic_thumb_down"
      />
   
</com.michaldrabik.tapbarmenulib.TapBarMenu>

This will create a menu with 2 icons in the bottom of the screen.

Then, in your code, call open(), close() or toggle() to open/close the menu:

tapBarMenu.setOnClickListener(new View.OnClickListener() {
  @Override public void onClick(View v) {
    tapBarMenu.toggle();
  }
});

Note: TapBarMenu will always expand to its parent width. You can choose between 2 anchors bottom or top - see attributes below.

Customize

All available XML parameters are listed below:

AttributeFormatDescription
app:tbm_showItemstrue, falseUse this to show menu's items in a XML preview window.
Useful for designing your menu.
Default: false
app:tbm_backgroundColorcolorMenu color.
Default: red
app:tbm_buttonSizedimensionDiameter of the menu button.
Default: 56dp
app:tbm_buttonPositionleft, right, centerPosition of the menu button.
Default: center
app:tbm_buttonMarginRightdimensionButton position right margin.
Default: 0
app:tbm_buttonMarginLeftdimensionButton position left margin.
Default: 0
app:tbm_iconOpeneddrawableCustom icon for opened state. Must be an animated vector drawable.
Default: X icon
app:tbm_iconCloseddrawableCustom icon for closed state. Must be an animated vector drawable.
Default: Menu icon
app:tbm_menuAnchortop, bottomWhere menu should expand.
Default: bottom

Kudos

I've been inspired by Aaron Benjamin's great design.

Release Notes

1.0.6 - Update Android dependencies and migrate to JitPack
1.0.5 - Added Regular Drawable support
1.0.4 - Memory optimizations, onClick listener fixes
1.0.2 - You can now add custom icon via XML or code. See attributes.
1.0.1 - Pre 21 SDK bugfixes
1.0.0 - Initial release

License

Copyright (C) 2019 Michal Drabik

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.