Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Xamarin.Android Binding Library for Ittianyu BottomNavigationViewEx

License

NotificationsYou must be signed in to change notification settings

NAXAM/bottomnavigationviewex-android-binding

Repository files navigation

Xamarin.Android Binding Library forIttianyu BottomNavigationViewEx

Install-Package Naxam.Ittianyu.BottomNavExtension

Features

MethodDescription
enableAnimationEnable or disable click item animation(text scale and icon move animation in no item shifting mode). Default true.
enableItemShiftingModeEnable the shifting mode for each item. It will has a shift animation for item if true. Otherwise the item text always be shown. Default true when item count > 3.
enableShiftingModeEnable the shifting mode for navigation. It will has a shift animation if true. Otherwise all items are the same width. Default true when item count > 3.
getBottomNavigationItemViewGet private mButton in mMenuView at position
getBottomNavigationItemViewsGet private mButtons in mMenuView
getCurrentItemGet the current checked item position.
getIconAtGet icon at position.
getItemCountGet item count.
getItemHeightGet item height.
getLargeLabelAtGet large label at position. Each item has tow label, one is large, another is small.
getSmallLabelAtGet small label at position. Each item has tow label, one is large, another is small.
getMenuItemPositionGet menu item position in menu. Return position if success, -1 otherwise.
getOnNavigationItemSelectedListenerGet OnNavigationItemSelectedListener.
setCurrentItemSet the current checked item.
setIconSizeSet all item ImageView size.
setIconSizeAtSet all item ImageView size which at position.
setIconVisibilityChange the visibility of icon.
setItemHeightSet menu item height.
setLargeTextSizeSet all item large TextView size. Each item has tow label, one is large, another is small. Small one will be shown when item state is normal. Large one will be shown when item checked.
setSmallTextSizeSet all item small TextView size. Each item has tow label, one is large, another is small. Small one will be shown when item state is normal. Large one will be shown when item checked.
setTextSizeSet all item large and small TextView size.
setTextVisibilityChange the visibility of text.
setTypefaceset Typeface for all item TextView.
setupWithViewPagerThis method will link the given ViewPager and this BottomNavigationViewEx together so that changes in one are automatically reflected in the other. This includes scroll state changes and clicks.

Example

Style

With ViewPager

Add ViewBadger

Adding to project

Sdk Version

compileSdkVersion >= 25

Getting started

Adding a custom widget inxml :

<com.ittianyu.bottomnavigationviewex.BottomNavigationViewExandroid:id="@+id/bnve"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"android:background="@color/colorPrimary"app:itemIconTint="@color/selector_item_color"app:itemTextColor="@color/selector_item_color"app:menu="@menu/menu_navigation_with_view_pager" />

Binding view inActivity:

BottomNavigationViewExbnve =FindViewById<BottomNavigationViewEx>(Resource.Id.bnve);

Disable all animations

bnve.enableAnimation(false);bnve.enableShiftingMode(false);bnve.enableItemShiftingMode(false);

Custom text and icon size

bnve.setIconSize(widthDp,heightDp);bnve.setTextSize(sp);

Binding with ViewPager

// set adapteradapter =newVpAdapter(getSupportFragmentManager(),fragments);bind.vp.setAdapter(adapter);// binding with ViewPagerbind.bnve.setupWithViewPager(bind.vp);

Other usage in BottomNavigationViewEx

You can see the demo.

Usage in BottomNavigationView

Other usage is the same as officialBottomNavigationView.You canclick here for detail.

ProGuard

If you are using ProGuard you might need to add the following option:

-keep public class android.support.design.widget.BottomNavigationView { *; }-keep public class android.support.design.internal.BottomNavigationMenuView { *; }-keep public class android.support.design.internal.BottomNavigationPresenter { *; }-keep public class android.support.design.internal.BottomNavigationItemView { *; }

References

The lib is based onBottomNavigationView inSupport Library 25 design.

I found it was inflexible when I try in demo. For example, I can't change the current checked item by code. So I write a class extends it to provide some useful method.

You no need to worry about stability. Because I minimise modifying by reflecting.

Thanks

License

MIT LicenseCopyright (c) 2019 NAXAMPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.

[8]ページ先頭

©2009-2025 Movatter.jp