{"id":15026196,"url":"https://github.com/ittianyu/bottomnavigationviewex","last_synced_at":"2025-05-14T20:10:35.555Z","repository":{"id":39042787,"uuid":"73541549","full_name":"ittianyu/BottomNavigationViewEx","owner":"ittianyu","description":"An android lib for enhancing BottomNavigationView. 一个增强BottomNavigationView的安卓库。","archived":false,"fork":false,"pushed_at":"2024-04-21T20:10:20.000Z","size":1770,"stargazers_count":3474,"open_issues_count":58,"forks_count":557,"subscribers_count":81,"default_branch":"master","last_synced_at":"2025-04-13T16:01:45.362Z","etag":null,"topics":["bottomnavigationview"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ittianyu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-12T08:39:38.000Z","updated_at":"2025-03-31T12:54:30.000Z","dependencies_parsed_at":"2024-09-20T19:30:41.078Z","dependency_job_id":"ffda84b5-95d2-4650-baa4-c3865c084451","html_url":"https://github.com/ittianyu/BottomNavigationViewEx","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ittianyu%2FBottomNavigationViewEx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ittianyu%2FBottomNavigationViewEx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ittianyu%2FBottomNavigationViewEx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ittianyu%2FBottomNavigationViewEx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ittianyu","download_url":"https://codeload.github.com/ittianyu/BottomNavigationViewEx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254219374,"owners_count":22034397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bottomnavigationview"],"created_at":"2024-09-24T20:04:01.287Z","updated_at":"2025-05-14T20:10:35.530Z","avatar_url":"https://github.com/ittianyu.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## [中文版点我](/README_ZH.md) ##\n\n## BottomNavigationViewEx ##\nAn android lib for enhancing BottomNavigationView.\n\n![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg) ![api 9+](https://img.shields.io/badge/API-9%2B-green.svg)\n\n\n## \u003ca name=\"donate\"\u003eDonator\u003c/a\u003e ##\n\n| Info | Amount |\n|-------|------|\n| [Linsong Wang](https://github.com/wanglinsong) | 100$ |\n\n\n## Features ##\n\n|Method|Description\n|---|---|\n|enableAnimation|Enable or disable click item animation(text scale and icon move animation in no item shifting mode). Default true.\n|enableItemShiftingMode|Enable the shifting mode for each item. It will have a shifting animation for item if true. Otherwise the item text is always shown. Default true when item count \u003e 3.\n|enableShiftingMode|Enable 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 \u003e 3.\n|getBottomNavigationItemView|Get private mButton in mMenuView at position\n|getBottomNavigationItemViews|Get private mButtons in mMenuView\n|getCurrentItem|Get the current checked item position.\n|getIconAt|Get icon at position.\n|getItemCount|Get item count.\n|getItemHeight|Get item height.\n|getLargeLabelAt|Get large label at position. Each item has two labels, one is large, the other is small.\n|getSmallLabelAt|Get small label at position. Each item has two labels, one is large, the other is small.\n|getMenuItemPosition|Get menu item position in menu. Return position if success, -1 otherwise.\n|getOnNavigationItemSelectedListener|Get OnNavigationItemSelectedListener.\n|setCurrentItem|Set the currently checked item.\n|setIconMarginTop|set margin top for icon.\n|setIconSize|Set all item ImageView size.\n|setIconSizeAt|Set all item ImageView size which is at position.\n|setIconsMarginTop|set margin top for all icons.\n|setIconTintList| Set item icon tint list.\n|setIconVisibility|Change the visibility of an icon.\n|setItemBackground| Set background of item.\n|setItemHeight|Set menu item height.\n|setLargeTextSize|Set all item large TextView size. Each item has two labels, one small and one large. The small one will be shown when item state is normal. The large one will be shown when item is checked.\n|setSmallTextSize|Set all item small TextView size. Each item has two labels, one small and one large. The small one will be shown when item state is normal. The large one will be shown when item is checked.\n|setTextSize|Set all item large and small TextView size.\n|setTextTintList|Set item TextView color.\n|setTextVisibility|Change the visibility of text.\n|setTypeface|set Typeface for all item TextView.\n|setupWithViewPager|This 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.\n\n\n## Example ##\n\n**Style**\n\n![](/read_me_images/normal.gif)\n\n![](/read_me_images/no_animation.gif)\n\n![](/read_me_images/no_shifting_mode.gif)\n\n![](/read_me_images/no_item_shifting_mode.gif)\n\n![](/read_me_images/no_text.gif)\n\n![](/read_me_images/no_icon.gif)\n\n![](/read_me_images/no_animation_shifting_mode.gif)\n\n![](/read_me_images/no_animation_item_shifting_mode.gif)\n\n![](/read_me_images/no_animation_shifting_mode_item_shifting_mode.gif)\n\n![](/read_me_images/no_shifting_mode_item_shifting_mode_text.gif)\n\n![](/read_me_images/no_animation_shifting_mode_item_shifting_mode_text.gif)\n\n![](/read_me_images/no_shifting_mode_item_shifting_mode_and_icon.gif)\n\n![](/read_me_images/no_item_shifting_mode_icon.gif)\n\n![](/read_me_images/no_animation_shifting_mode_item_shifting_mode_icon.gif)\n\n**Attention: Something wrong on Android 4.x**\n\n![](/read_me_images/with_padding.jpg)\n\n![](/read_me_images/center_icon_only.jpg)\n\n![](/read_me_images/smaller_text.jpg)\n\n![](/read_me_images/bigger_icon.jpg)\n\n![](/read_me_images/custom_typeface.jpg)\n\n![](/read_me_images/icon_selector_1.jpg) ![](/read_me_images/icon_selector_2.jpg)\n\n![](/read_me_images/icon_margin_top.jpg)\n\n![](/read_me_images/unchecked_first_time.jpg)\n\n\n**With ViewPager**\n\n![](/read_me_images/with_view_pager.gif)\n\n**Add ViewBadger**\n\n![](/read_me_images/view_badger.gif)\n\n**Center Floating Action Button**\n\n![](/read_me_images/center_fab.jpg)\n\n\n## Adding to project ##\n\n### Sdk Version ###\n`compileSdkVersion` \u003e= 25\n\n### Importing to project(choose one) ###\n\n#### Example for Gradle: ####\n\nStep 1. Add it in your root build.gradle at the end of repositories:\n```groovy\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url \"https://jitpack.io\" }\n\t\tmaven { url \"https://maven.google.com\" }\n\t}\n}\n```\n\nStep 2. Add the dependency\n1. old version support lib is 25 or 26\n```groovy\ncompile 'com.github.ittianyu:BottomNavigationViewEx:1.2.4'\ncompile \"com.android.support:design:26.+\"\n```\n2. new version support lib = 28\n```groovy\nimplementation 'com.github.ittianyu:BottomNavigationViewEx:2.0.4'\nimplementation \"com.android.support:design:28.0.0\"\n```\n3. AndroidX\nuse new version，and add config into gradle.properties\n```\nandroid.useAndroidX=true\nandroid.enableJetifier=true\n```\n\n#### Manual: ####\n\nDownloading [BottomNavigationViewEx.java](https://raw.githubusercontent.com/ittianyu/BottomNavigationViewEx/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewEx.java) and copying it to you project.\n\n\n## Getting started ##\n\nAdding a custom widget in `xml` :\n```xml\n\u003ccom.ittianyu.bottomnavigationviewex.BottomNavigationViewEx\n    android:id=\"@+id/bnve\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_alignParentBottom=\"true\"\n    android:background=\"@color/colorPrimary\"\n    app:itemIconTint=\"@color/selector_item_color\"\n    app:itemTextColor=\"@color/selector_item_color\"\n    app:menu=\"@menu/menu_navigation_with_view_pager\" /\u003e\n```\n\nBinding view in `Activity`:\n```java\nBottomNavigationViewEx bnve = (BottomNavigationViewEx) findViewById(R.id.bnve);\n```\n\n#### Disable all animations ####\n```java\nbnve.enableAnimation(false);\nbnve.enableShiftingMode(false);\nbnve.enableItemShiftingMode(false);\n```\n\n#### Custom text and icon size ####\n```java\nbnve.setIconSize(widthDp, heightDp);\nbnve.setTextSize(sp);\n```\n\n#### Binding with ViewPager ####\n```java\n// set adapter\nadapter = new VpAdapter(getSupportFragmentManager(), fragments);\nbind.vp.setAdapter(adapter);\n\n// binding with ViewPager\nbind.bnve.setupWithViewPager(bind.vp);\n```\n\n#### Add badge view ####\n\n1. Add badge lib\n\t```\n\tcompile 'q.rorbin:badgeview:1.1.0'\n\t```\n2. Bind bottom view\n\t```\n    // add badge\n    addBadgeAt(2, 1);\n\n    private Badge addBadgeAt(int position, int number) {\n        // add badge\n        return new QBadgeView(this)\n                .setBadgeNumber(number)\n                .setGravityOffset(12, 2, true)\n                .bindTarget(bind.bnve.getBottomNavigationItemView(position))\n                .setOnDragStateChangedListener(new Badge.OnDragStateChangedListener() {\n                    @Override\n                    public void onDragStateChanged(int dragState, Badge badge, View targetView) {\n                        if (Badge.OnDragStateChangedListener.STATE_SUCCEED == dragState)\n                            Toast.makeText(BadgeViewActivity.this, R.string.tips_badge_removed, Toast.LENGTH_SHORT).show();\n                    }\n                });\n    }\n\t```\n\n#### Other usage in BottomNavigationViewEx ####\nYou can see the demo.\n\n#### Usage in BottomNavigationView ####\nOther usage is the same as official `BottomNavigationView`.\nYou can [click here](https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html) for detail.\n\n## ProGuard ##\n\nIf you are using ProGuard you might need to add the following option:\n\n#### None Android X ####\n```\n-keep public class android.support.design.widget.BottomNavigationView { *; }\n-keep public class android.support.design.internal.BottomNavigationMenuView { *; }\n-keep public class android.support.design.internal.BottomNavigationPresenter { *; }\n-keep public class android.support.design.internal.BottomNavigationItemView { *; }\n```\n\n#### Android X ####\n```\n-keep public class com.google.android.material.bottomnavigation.BottomNavigationView { *; }\n-keep public class com.google.android.material.bottomnavigation.BottomNavigationMenuView { *; }\n-keep public class com.google.android.material.bottomnavigation.BottomNavigationPresenter { *; }\n-keep public class com.google.android.material.bottomnavigation.BottomNavigationItemView { *; }\n```\n\n## References ##\n\nThe lib is based on `BottomNavigationView` in `Support Library 25 design`.\n\nI found it was inflexible when I tried the demo. For example, I couldn't change the currently checked item through code. So I wrote a class to extend it to provide some useful methods.\n\nYou have no need to worry about stability, because I minimised the modifications through reflection.\n\n## Thanks ##\n\nThanks to [Adrián Mouly](https://github.com/amouly) | [liaolintao](https://github.com/liaolintao) | [Luong Vo](https://github.com/luongvo).\n\n\n## License ##\n\n\tMIT License\n\t\n\tCopyright (c) 2017 ittianyu\n\t\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\n\tof this software and associated documentation files (the \"Software\"), to deal\n\tin the Software without restriction, including without limitation the rights\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\tcopies of the Software, and to permit persons to whom the Software is\n\tfurnished to do so, subject to the following conditions:\n\t\n\tThe above copyright notice and this permission notice shall be included in all\n\tcopies or substantial portions of the Software.\n\t\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n\tSOFTWARE.\n\n## Donate ##\n\n**paypal: admin@ittianyu.com**\n\n![](/read_me_images/donate_alipay.png) ![](/read_me_images/donate_wechat.png)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fittianyu%2Fbottomnavigationviewex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fittianyu%2Fbottomnavigationviewex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fittianyu%2Fbottomnavigationviewex/lists"}