Bottom Navigation Bar Android

Bottom Navigation Bar Android

Meet LoopBar – Tab Bar with Infinite Scrolling for Android by Cleveroad

At Cleveroad we’ve recently come to realize that navigation through categories in an app using nothing but a navigation panel is pretty boring and trivial. That’s why, armed with our designer’s creativity, we introduce you our new component for Android-based applications — LoopBar. The idea was to make the navigation menu right at fingerprints, in a tab bar. What’s more the view has a few specific features that make it stand out from the crowd of similar ones. So, try out the LoopBar library in your app and you’ll see the difference.

Demo image

If you strive to create an application with unusual looks and navigation, you are welcome to use the LoopBar library. It’s really easy to integrate and can add spice to any app!

If you need more details on how you can use the component and what benefits it provides, read our blog post: Case Study: Loop Bar for Android

Article image
Awesome

Setup and usage

Installation

by gradle :

or just download zip and import module “LoopBar-widget” to be able to modify the sources

Features

View consist from two parts:

  • A list of your selectable groups
  • Selected view

View can work in three scroll modes: infinite, finite and auto mode. Names of first two speak for itself. In auto mode the list of groups will be infinite if all adapter items didn’t fit on screen in other case it will be a static list. Selected view by request could overlay layout on screen on which it placed. Widget has horizontal and vertical layouts and also start or end gravity of selected view.

You are allowed to use any RecyclerView adapter, which you want. Concrete infinite scroll logic is fully encapsulated

Android Studio layouts preview is supported.

Usage

enls_overlaySize & enls_placeholderId are used for overlay feature. Placeholder must be the view lying under the LoopBar. And it’s used for setting bounds In layout when selected view has overlay. LoopBar will set width or height for this view by itself (depending of LoopBar orientation), it will be the same as LoopBar has. Without this placeholder the bounds of LoopBar will be limited by selected view (with overlay). And thanks to placeholder the bounds will be limited only by list of groups. You can see an example of overlay usage in sample.

attribute namedescription
enls_overlaySizea size of selected view overlaying
enls_orientationorientation of loopbar view. Can be verticalLeft, verticalRight, horizontalBottom, horizontalTop. Default verticalLeft
enls_placeholderIdan id of view on which you should use layout:above or other attributes of RelativeLayouts, because LoopBarView will have increased height in this case. See more in sample
enls_selectionGravitya gravity of selection view. Can be vertical or horizontal. Default horizontal
enls_selectionMargina margin of selectionView from bounds of view. Default 5dp
enls_selectionInAnimationan animation of appearing an icon inside selection view
enls_selectionOutAnimationan animation of hiding an icon inside selection view
enls_selectionBackgroundselection background. Default #ff0099cc
enls_menuan id of menu which will be used for getting title and icon items
enls_scrollModeScrolling mode. Can be infinitefiniteauto. Default infinite
android:backgroundView have yellow background by default. Use standart android:background attribute to change it. Default #ffc829

To initialize items in widget and work with it you should setup adapter to it and add item click mListener:

Here SimpleCategoriesAdapter is used which required collection of ICategoryItem objects (to draw default view with icon and text). 
Also you can setup adapter through:

  • ViewPager. Just set a viewPager into your LoopBar. If you want to show category icons, your ViewPager adapter must implement ILoopBarPagerAdapter interface (see example ViewPagerLoopBarFragment), otherwise the icons will not be shown:

To customize wrapped RecyclerView (control animations, decorators or add RecyclerView.OnScrollListener) you are able to use following methods:

method namedescription
setItemAnimator(RecyclerView.ItemAnimator animator)Sets the ItemAnimator to wrapped RecyclerView
isAnimating()Returns true if wrapped RecyclerView is currently running some animations
addItemDecoration(RecyclerView.ItemDecoration decor)Add an ItemDecoration to wrapped RecyclerView
addItemDecoration(RecyclerView.ItemDecoration decor, int index)Add an ItemDecoration to wrapped RecyclerView
removeItemDecoration(RecyclerView.ItemDecoration decor)Remove an ItemDecoration from wrapped RecyclerView
invalidateItemDecorations()Invalidates all ItemDecorations in wrapped RecyclerView
addOnScrollListener(RecyclerView.OnScrollListener listener)Add a OnScrollListener to wrapped RecyclerView
removeOnScrollListener(RecyclerView.OnScrollListener listener)Remove a OnScrollListener from wrapped RecyclerView
clearOnScrollListeners()Remove all secondary OnScrollListener from wrapped RecyclerView

126 total views, 1 views today

(Visited 42 times, 1 visits today)

You May Also Like

About the Author: Android Developer

This is Mohammad I am Android Application Developer. I am the founder of Android Tutorial Online blog. I am programming lover and professional blogger from India. I spend most of my time doing programming and helping other programmers. This Android tutorial online blog for learning and share Android code.
My Chatbot
Powered by Replace Me