在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):armcha/LuseenBottomNavigation开源软件地址(OpenSource Url):https://github.com/armcha/LuseenBottomNavigation开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):Material Bottom NavigationDEPRECATEDUse offical Bottom Navigation BottomNavigationView Designed according Google [guideLine][1] [1]: https://www.google.com/design/spec/components/bottom-navigation.html#bottom-navigation-usage [2]: http://luseen.com/ [3]: http://fir.im/luseen?release_id=56feaea800fc741d61000000 By [Luseen][2] Technologies [Download simple apk][3] DownloadGradle: compile 'com.github.armcha:LuseenBottomNavigation:1.8.2' Maven: <dependency>
<groupId>com.github.armcha</groupId>
<artifactId>LuseenBottomNavigation</artifactId>
<version>1.8.2</version>
<type>pom</type>
</dependency> UsageAdd the BottomNavigationView to your layout <com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView
android:id="@+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" /> Add BottomNavigation items BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottomNavigation);
BottomNavigationItem bottomNavigationItem = new BottomNavigationItem
("Record", ContextCompat.getColor(this, R.color.firstColor), R.drawable.ic_mic_black_24dp);
BottomNavigationItem bottomNavigationItem1 = new BottomNavigationItem
("Like", ContextCompat.getColor(this, R.color.secondColor), R.drawable.ic_favorite_black_24dp);
bottomNavigationView.addTab(bottomNavigationItem);
bottomNavigationView.addTab(bottomNavigationItem1); Then set your
bottomNavigationView.setOnBottomNavigationItemClickListener(new OnBottomNavigationItemClickListener() {
@Override
public void onNavigationItemClick(int index) {
Toast.makeText(MainActivity.this, "Item " +index +" clicked", Toast.LENGTH_SHORT).show();
}
}); If you are using a ContextCompat.getColor(context, R.color.firstColor)
bottomNavigationView.setUpWithViewPager(yourPager , colorResources , imageResources); You can disable slide animation when using viewPager bottomNavigationView.disableViewPagerSlide(); If your activity/fragment will not recreate and bottom navigation items doubled on orientation change, just can call this method bottomNavigationView.willNotRecreate(true); CustomizeCustomize with xml <com.luseen.luseenbottomnavigation.BottomNavigation.BottomNavigationView
android:id="@+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:bnv_colored_background="true"
app:bnv_with_text="false"
app:bnv_shadow="true"
app:bnv_tablet="false"
app:bnv_viewpager_slide="true"
app:bnv_active_color="@color/colorPrimary"
app:bnv_active_text_size="@dimen/bottom_navigation_text_size_active"
app:bnv_inactive_text_size="@dimen/bottom_navigation_text_size_inactive"/> or programmatically You can activate tablet mode bottomNavigationView.activateTabletMode(); bottomNavigationView.isWithText(true); bottomNavigationView.isColoredBackground(false);
bottomNavigationView.setItemActiveColorWithoutColoredBackground(yourColor); Change text active or inactive size bottomNavigationView.setTextActiveSize(float yoursize);
bottomNavigationView.setTextInactiveSize(float yoursize); Change tab programmatically bottomNavigationView.selectTab(int position); You can just disable BottomNavigationView shadow by calling bottomNavigationView.disableShadow(); You can set your custom font for item text. assets/fonts/your_font.ttf bottomNavigationView.setFont(Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/your_font.ttf")); ContactPull requests are more than welcome. Please fell free to contact me if there is any problem when using the library.
License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论