本文整理汇总了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);
}
}
示例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();
}