How to create bottom navigation bar similar to instagram

前端 未结 5 2026
臣服心动
臣服心动 2020-12-29 17:18

I am an android newbie trying to create a bottom navigation bar for my new android app similar to one there in Instagram. Like this where clicking on the search icon adds a

5条回答
  •  有刺的猬
    2020-12-29 18:03

    The concept of tabs is that you have to have a MainActivity, which will handle let's say 3 fragments. With the code that @Alireza suggested, you will handle the change between fragments. Please look over a tutorial on how to implement Tabs ( like this one here ) . After that, in your "SearchFragment.java" you will build your XML accordingly with your Search bar on top, and recycler view below, or whatever you wish. Suggestion: When using fragments, be sure to have a Context mContext = getActivity(); defined first, as it will be easier for you to implement all the features.

    *For you to achieve the bottom tab effect, you can move android.support.design.widget.TabLayout to the bottom of the screen

提交回复
热议问题