当前位置: 首页>>代码示例>>C#>>正文


C# Activity.ObtainStyledAttributes方法代码示例

本文整理汇总了C#中Android.App.Activity.ObtainStyledAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.ObtainStyledAttributes方法的具体用法?C# Activity.ObtainStyledAttributes怎么用?C# Activity.ObtainStyledAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.App.Activity的用法示例。


在下文中一共展示了Activity.ObtainStyledAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SystemBarTintManager

        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);
            }

        }
开发者ID:skywolf888,项目名称:SystemBarTint.Net,代码行数:55,代码来源:SystemBarTintManager.cs

示例2: OnInflate

            /**
             * 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();
            }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:12,代码来源:FragmentArgumentsSupport.cs


注:本文中的Android.App.Activity.ObtainStyledAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。