https://github.com/codingspecialist/InstagramClone-Android-Firestore

 

여러액티비티에서 툴바 + 드로어블 사용하려면

헬퍼를 이용해야한다

 

메인

    private void setupBottomNavigationView(){
        BottomNavigationView bottomNavigationView = findViewById(R.id.bottomNavigationView);
        BottomNavigationViewHelper.enableNavigation(mContext, bottomNavigationView);
        Menu menu = bottomNavigationView.getMenu();
        MenuItem menuItem = menu.getItem(ACTIVITY_NUM);
        menuItem.setChecked(true);
    }

 

layout_bottom_navigation_view.xml

  
<merge xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="50dp">

        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottomNavigationView"
            android:background="@drawable/white_grey_border_top"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:labelVisibilityMode="unlabeled"
            app:menu="@menu/bottom_navigation_menu">

        </com.google.android.material.bottomnavigation.BottomNavigationView>

    </RelativeLayout>
</merge>

 

 

+ Recent posts