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.
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
by gradle :
or just download zip and import module “LoopBar-widget” to be able to modify the sources
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.
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.
|enls_overlaySize||a size of selected view overlaying|
|enls_orientation||orientation of loopbar view. Can be verticalLeft, verticalRight, horizontalBottom, horizontalTop. Default verticalLeft|
|enls_placeholderId||an 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_selectionGravity||a gravity of selection view. Can be vertical or horizontal. Default horizontal|
|enls_selectionMargin||a margin of selectionView from bounds of view. Default |
|enls_selectionInAnimation||an animation of appearing an icon inside selection view|
|enls_selectionOutAnimation||an animation of hiding an icon inside selection view|
|enls_selectionBackground||selection background. Default |
|enls_menu||an id of menu which will be used for getting title and icon items|
|enls_scrollMode||Scrolling mode. Can be |
|android:background||View have yellow background by default. Use standart |
To initialize items in widget and work with it you should setup adapter to it and add item click mListener:
LoopBarView loopBarView = findViewById(...);
categoriesAdapter = new SimpleCategoriesAdapter(MockedItemsFactory.getCategoryItems(getContext()));
Here SimpleCategoriesAdapter is used which required collection of ICategoryItem objects (to draw default view with icon and text).
Also you can setup adapter through:
- Menu via Java code (see example MenuLoopBarFragment):
Menu menu = ...;
or via XML:
- 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:
|Sets the |
|Returns true if wrapped RecyclerView is currently running some animations|
|Add an |
|Add an |
|Remove an |
|Invalidates all |
|Add a |
|Remove a |
|Remove all secondary |
306 total views, 3 views today