private void init ( ) { // MarginLayoutParams marginParams = new ViewGroup.MarginLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_padded_height))); // marginParams.setMargins(0, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_top_margin_correction), 0, 0); setLayoutParams ( new ViewGroup . LayoutParams ( new ViewGroup . LayoutParams ( ViewGroup . LayoutParams . MATCH_PARENT , ViewGroup . LayoutParams . WRAP_CONTENT ) ) ) ; LayoutInflater inflater = LayoutInflater . from ( getContext ( ) ) ; View parentView = inflater . inflate ( R . layout . bottom_navigation_bar_container , this , true ) ; mBackgroundOverlay = parentView . findViewById ( R . id . bottom_navigation_bar_overLay ) ; mContainer = parentView . findViewById ( R . id . bottom_navigation_bar_container ) ; mTabContainer = parentView . findViewById ( R . id . bottom_navigation_bar_item_container ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { this . setOutlineProvider ( ViewOutlineProvider . BOUNDS ) ; } else { //to do } ViewCompat . setElevation ( this , mElevation ) ; setClipToPadding ( false ) ; }
This method initiates the bottomNavigationBar and handles layout related values