简体   繁体   English

如何实现这个底部导航栏

[英]How to implement this bottom navigation bar

Hei I have the new android studio 4.1嘿我有新的android studio 4.1

I have imported a bottom navigation menu from git hub here this one我已经从 git 集线器这里导入了一个底部导航菜单

Now I have set up dependencies correctly I did all the things necessary but still, there are no actions in the navigation bar, the colour is not changing.现在我已经正确设置了依赖关系,我做了所有必要的事情,但是导航栏中没有任何操作,颜色没有改变。 even the menus are not displaying连菜单都没有显示

here is the main activity code这是主要的活动代码


     <me.ibrahimsn.lib.SmoothBottomBar
            android:id="@+id/bottomBar"
            android:layout_width="match_parent"
            android:layout_height="70dp"
            app:backgroundColor="@color/colorPrimary"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:menu="@menu/menu" />
    
    
          </androidx.constraintlayout.widget.ConstraintLayout> 



this is the menu code
  

       <?xml version="1.0" encoding="utf-8"?>
            <menu xmlns:android="http://schemas.android.com/apk/res/android">
     
            <item android:id="@+id/home"
            android:title="Home"/>
    
            <item android:id="@+id/rank"
            android:title="Rank"/>
            </menu>  

now still the background is white see this: image still not changing现在仍然背景是白色的看到这个:图像仍然没有改变在此处输入图像描述

Have you added this line in your layout parent tag:您是否在布局父标签中添加了这一行:

xmlns:app = "http://schemas.android.com/apk/res-auto"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM