标签: bottomnavigationview

如何禁用BottomNavigationView转换模式?

BottomNavigationView不显示不活动的菜单标题.

如何在bottomNavigationBar中显示所有菜单元素的标题?问题是在我的情况下只显示了点击元素的标题.

在此输入图像描述

android android-support-design bottomnavigationview

139
推荐指数
10
解决办法
7万
查看次数

Android新的底部导航栏或BottomNavigationView

看到新的指南出来了,并在google photos最新的应用程序中使用.不知道如何使用新的底部导航栏.通过新的支持lib查看,没有发现任何领先优势.

在此输入图像描述

找不到任何官方样品.

如何使用新的底栏?不想做任何自定义.

android bottomnavigationview

130
推荐指数
7
解决办法
22万
查看次数

在Android BottomNavigationView中设置所选项目

我正在使用android.support.design.widget.BottomNavigationView支持库中的新功能.如何从代码中设置当前选择?我意识到,旋转屏幕后,选择会更改回第一项.当然,它也将有所帮助,如果有人能告诉我,如何"拯救"的当前状态BottomNavigationViewonPause功能,以及如何将其在恢复onResume.

谢谢!

android bottomnavigationview

98
推荐指数
13
解决办法
8万
查看次数

BottomNavigationView始终显示图标和文本标签

我正在使用设计支持库版本25中的android.support.design.widget.BottomNavigationView

compile 'com.android.support:design:25.0.0'

<android.support.design.widget.BottomNavigationView
        android:id="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="center"
        app:itemBackground="@color/colorPrimary"
        app:menu="@menu/bottom_navigation_main"
        android:forceHasOverlappingRendering="true"/>
Run Code Online (Sandbox Code Playgroud)

当@ menu/bottom_navigation_main中只有三个动作时,它会一直显示图标和文本标签.

当有三个以上的操作时,始终显示图标和文本标签的方法是什么.

android android-support-library android-support-design bottomnavigationview

89
推荐指数
8
解决办法
5万
查看次数

在底部导航栏的图标顶部显示徽章

我已经实现了我的应用程序底部的导航视图和我看过的每一个地方上的,如图标上方显示的徽章这个 我不知道这是否是甚至有可能实现.任何帮助表示赞赏.谢谢.

android material-design bottomnavigationview

60
推荐指数
9
解决办法
5万
查看次数

删除BottomNavigationView标签

谷歌发布了支持BottomNavigationView的新支持库v25

在此输入图像描述

有没有办法删除商品标签?

android android-support-library androiddesignsupport bottomnavigationview

56
推荐指数
6
解决办法
4万
查看次数

当使用BottomNavigationView和新的NavController时,有没有办法保持片段活着?

我正在尝试使用新的导航组件.我使用带有navController的BottomNavigationView:NavigationUI.setupWithNavController(bottomNavigation,navController)

但是当我切换片段时,即使它们以前被使用过,它们也会每次都被破坏/创建.

有没有办法让我们的主要片段链接到我们的BottomNavigationView?

navigation android bottomnavigationview

55
推荐指数
3
解决办法
1万
查看次数

Android Jetpack导航,使用Youtube或Instagram的BottomNavigationView,如正确的后退导航(片段后退堆栈)?

Android Jetpack导航,BottomNavigationView在后退按钮上点击自动片段后栈?

我想要的是,在用户一个接一个地选择多个标签后,用户点击后退按钮应用必须重定向到他/她打开的最后一页.

通过在ArrayList中保存当前选定的项目,我使用Android ViewPager实现了相同的功能.Android Jetpack导航发布后是否有任何自动后退堆栈?我想用导航图实现它

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".main.MainActivity">

    <fragment
        android:id="@+id/my_nav_host_fragment"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:defaultNavHost="true"
        app:layout_constraintBottom_toTopOf="@+id/navigation"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:navGraph="@navigation/nav_graph" />

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="0dp"
        android:layout_marginEnd="0dp"
        android:background="?android:attr/windowBackground"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:menu="@menu/navigation" />

</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

navigation.xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/navigation_home"
        android:icon="@drawable/ic_home"
        android:title="@string/title_home" />

    <item
        android:id="@+id/navigation_people"
        android:icon="@drawable/ic_group"
        android:title="@string/title_people" />

    <item
        android:id="@+id/navigation_organization"
        android:icon="@drawable/ic_organization"
        android:title="@string/title_organization" />

    <item
        android:id="@+id/navigation_business"
        android:icon="@drawable/ic_business"
        android:title="@string/title_business" />

    <item
        android:id="@+id/navigation_tasks"
        android:icon="@drawable/ic_dashboard"
        android:title="@string/title_tasks" />

</menu>
Run Code Online (Sandbox Code Playgroud)

还补充道

bottomNavigation.setupWithNavController(Navigation.findNavController(this, R.id.my_nav_host_fragment))
Run Code Online (Sandbox Code Playgroud)

我得到了一个答案Levi …

android android-navigation bottomnavigationview android-architecture-components android-architecture-navigation

50
推荐指数
7
解决办法
2万
查看次数

在选定的底部导航视图项上重新创建片段

以下是我选择的底部导航视图项的代码

bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {  
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    Fragment fragment = null;
    switch (item.getItemId()) {
        case R.id.action_one:
            // Switch to page one
            fragment = FragmentA.newInstance();
            break;
        case R.id.action_two:
            // Switch to page two
            fragment = FragmentB.newInstance();
            break;
        case R.id.action_three:
            // Switch to page three
            fragment = FragmentC.newInstance();
            break;
    }
    getSupportFragmentManager().beginTransaction().replace(R.id.container,fragment,"TAG").commit();
    return true;
}
});
Run Code Online (Sandbox Code Playgroud)

现在我的问题是每次重新创建片段并且不希望每次我都尝试添加addToBackStack(null)时重新创建片段,但是这种情况在后面按钮按下时会不断地从堆栈中弹出片段,这是我不想要的.

有没有办法在选定的底部导航栏上显示片段而无需重新创建片段

android android-fragments android-support-library bottomnavigationview

43
推荐指数
7
解决办法
3万
查看次数

在Scroll上隐藏/显示bottomNavigationView

我必须在向上滚动时隐藏底部导航视图并在向下滚动时显示.如何实现这一点?我的布局是这样的

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_above="@+id/navigation"
        android:layout_alignParentTop="true"
        android:layout_marginBottom="5dp">

        <FrameLayout
            android:id="@+id/container1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
          />


    </LinearLayout>

    <android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="?android:attr/windowBackground"
        app:layout_scrollFlags="scroll|enterAlways|snap"
        app:menu="@menu/dashboard_slider_menu" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我附上了视图的截图.请检查一下.

在此输入图像描述

android android-layout android-fragments bottomnavigationview

42
推荐指数
4
解决办法
5万
查看次数