Android底部导航栏的实现方式特别多,例如TabHost,TabLayout,或者TextView等,都可以实现底部导航栏的效果,但是却没有Google官方统一的导航栏样式,今天讲的就是Google最近添加到Material design中的底部导航栏BottomNavigationBar,也可以说是现今Android底部导航栏的一个标准与统一吧。 效果: 实现效果: 实现: 1.下载jar包 ...
2.设置导航栏背景模式:setBackgroundStyle() Attribute: background_style_static, background_style_ripple,background_style_default Method:setBackgroundStyle()Values:BACKGROUND_STYLE_STATIC, BACKGROUND_STYLE_RIPPLE .setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE) 3.设置BottomNavigationItem颜色...
/*1.首先进行fvb*/bottomNavigationBar=(BottomNavigationBar)findViewById(R.id.bottom_nav_bar);/*2.进行必要的设置*/bottomNavigationBar.setBarBackgroundColor(R.color.colorPrimary);bottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE);bottomNavigationBar.setMode(BottomNavigationB...
当bottom navigation 只有三个 Item 的时候,他们的图标和文字都应该被显示。 当bottom navigation 有四个或者五个 Item 的时候,在非激活状态的时候只显示他们的图标即可。 1.2颜色 Tint the current bottom navigation action (including the icon and any text label present) with the app’s primary color 用应...
BottomNavigationBar这个控件的使用之前已经写过,这里不再赘述,详情请参考BottomNavigationBar的使用。 下面直接上代码: 初始化及相关设置: 复制 mBottomNavigationBar = (BottomNavigationBar)view.findViewById(R.id.bottom_navigation_bar);mBottomNavigationBar.setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_ST...
选中的会显示文字setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_STATIC) //点击的时候没有水波纹效果setBackgroundStyle(BottomNavigationBar.BACKGROUND_STYLE_RIPPLE) //点击的时候有水波纹效果,也就是导航条的背景色是你设置的处于选中状态的 Item的颜色addItem(new BottomNavigationItem(R.mipmap.ic_...
<p>Android底部导航栏的实现方式特别多,例如TabHost,TabLayout,或者TextView等,都可以实现底部导航栏的效果,但是却没有Google官方统一的导航栏样式,今天讲的就是Google最近添加到Material design中的底部导航栏BottomNavigationBar,也可以说是现今Android底部导航栏的一个标准与统一吧。</p> <p>效果:</p> <p><img...
//BottomBar(方法1) implementation 'com.roughike:bottom-bar:2.3.1' // BottomNavigationView(方法2) implementation 'com.google.android.material:material:1.1.0' 1. 2. 3. 4. 5. 2.在activity_main.xmlz中设置 方法1: <!--FrameLayout(用于多Fragment切换)--> ...
android:supportsRtl="true" android:theme="@style/Theme.AppCompat.Light.NoActionBar" tools:targetApi="31"> <activity android:name=".SettingsActivity" android:exported="false" android:label="@string/title_activity_settings" /> <activity android:name=".MainActivity" ...
gitHub地址:https://github.com/Ashok-Varma/BottomNavigation一、基本使用1.在AndroidStudio下添加依赖: compile 'com.ashokvarma.android:bottom-navigation-bar:2.0.3' 2.在布局文件中,添加布局1 2 3 4 <com.ashokvarma.bottomnavigation.BottomNavigationBar android:id="@+id/bottom_navigation_bar" android:...