/// <summary> /// DrawerLayout+ToolBar+TabLayout״̬À¸(ToolBar¿ÉÉìËõ) /// </summary> /// <param name="activity"></param> /// <param name="coordinatorLayout"></param> public static void SetDrawerToolbarTabLayout(Activity activity, CoordinatorLayout coordinatorLayout) { if (Build.VERSION.SdkInt == BuildVersionCodes.Kitkat) { ViewGroup contentLayout = activity.FindViewById <ViewGroup>(Android.Resource.Id.Content); contentLayout.GetChildAt(0).SetFitsSystemWindows(false); coordinatorLayout.SetFitsSystemWindows(true); SetKKStatusBar(activity, Resource.Color.statusBar); } }
/// <summary> /// CollapsingToolbarLayout״̬À¸ /// </summary> /// <param name="activity"></param> /// <param name="coordinatorLayout"></param> /// <param name="appBarLayout"></param> /// <param name="imageView"></param> /// <param name="toolbar"></param> public static void SetCollapsingToolbar(Activity activity, CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, View view, Toolbar toolbar) { if (Build.VERSION.SdkInt == BuildVersionCodes.Kitkat) { coordinatorLayout.SetFitsSystemWindows(false); appBarLayout.SetFitsSystemWindows(false); view.SetFitsSystemWindows(false); toolbar.SetFitsSystemWindows(true); CollapsingToolbarLayout.LayoutParams lp = (CollapsingToolbarLayout.LayoutParams)toolbar.LayoutParameters; lp.Height = (int)(GetStatusBarHeight(activity) + activity.Resources.GetDimension(Resource.Dimension.abc_action_bar_default_height_material)); toolbar.LayoutParameters = lp; SetKKStatusBar(activity, Resource.Color.statusBar); SetCollapsingToolbarStatus(appBarLayout); } }