public SystemBarTintManager(Activity activity) { Window win = activity.Window; ViewGroup decorViewGroup = (ViewGroup)win.DecorView; if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat) { // check theme attrs int[] attrs = {Android.Resource.Attribute.WindowTranslucentStatus, Android.Resource.Attribute.WindowTranslucentNavigation}; TypedArray a = activity.ObtainStyledAttributes(attrs); try { mStatusBarAvailable = a.GetBoolean(0, false); mNavBarAvailable = a.GetBoolean(1, false); } finally { a.Recycle(); } // check window flags //IWindowManager.LayoutParams WindowManagerLayoutParams winParams = win.Attributes; WindowManagerFlags bits = WindowManagerFlags.TranslucentStatus; if ((winParams.Flags & bits) != 0) { mStatusBarAvailable = true; } bits = WindowManagerFlags.TranslucentNavigation; if ((winParams.Flags & bits) != 0) { mNavBarAvailable = true; } } mConfig = new SystemBarConfig(activity, mStatusBarAvailable, mNavBarAvailable); // device might not have virtual navigation keys if (!mConfig.hasNavigtionBar()) { mNavBarAvailable = false; } if (mStatusBarAvailable) { setupStatusBarView(activity, decorViewGroup); } if (mNavBarAvailable) { setupNavBarView(activity, decorViewGroup); } }
/** * Parse attributes during inflation from a view hierarchy into the * arguments we handle. */ public override void OnInflate(Activity activity, Android.Util.IAttributeSet attrs, Bundle savedInstanceState) { base.OnInflate (activity, attrs, savedInstanceState); var a = activity.ObtainStyledAttributes(attrs,Resource.Styleable.FragmentArguments); mLabel = a.GetText(Resource.Styleable.FragmentArguments_android_label); a.Recycle(); }