本文整理汇总了C#中Android.ObtainStyledAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# Android.ObtainStyledAttributes方法的具体用法?C# Android.ObtainStyledAttributes怎么用?C# Android.ObtainStyledAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android
的用法示例。
在下文中一共展示了Android.ObtainStyledAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
private void Init(Android.Content.Context context, IAttributeSet attrs, int p)
{
TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.CircleProgressBar, p, 0);
float density = context.Resources.DisplayMetrics.Density;
mBackGroundColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_background_color, DEFAULT_CIRCLE_BG_LIGHT);
mProgressColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_color, DEFAULT_CIRCLE_BG_LIGHT);
mInnerRadius = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_inner_radius, -1);
mProgressStokeWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_stoke_width, (int)(STROKE_WIDTH_LARGE * density));
mArrowWidth = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_width, -1);
mArrowHeight = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_arrow_height, -1);
mTextSize = a.GetDimensionPixelOffset(Resource.Styleable.CircleProgressBar_mlpb_progress_text_size, (int)(DEFAULT_TEXT_SIZE * density));
mTextColor = a.GetColor(Resource.Styleable.CircleProgressBar_mlpb_progress_text_color, Color.Black);
mShowArrow = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_show_arrow, false);
mCircleBackgroundEnabled = a.GetBoolean(Resource.Styleable.CircleProgressBar_mlpb_enable_circle_background, true);
mProgress = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress, 0);
mMax = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_max, 100);
int textVisible = a.GetInt(Resource.Styleable.CircleProgressBar_mlpb_progress_text_visibility, 1);
if (textVisible != 1)
{
mIfDrawText = true;
}
mTextPaint = new Paint();
mTextPaint.SetStyle(Paint.Style.Fill);
mTextPaint.Color = mTextColor;
mTextPaint.TextSize = mTextSize;
mTextPaint.AntiAlias = true;
a.Recycle();
mProgressDrawable = new MaterialProgressDrawale(Context, this);
base.SetImageDrawable(mProgressDrawable);
}
示例2: Init
private void Init(Android.Content.Context context, IAttributeSet attrs)
{
TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.LoadingView);
loadText = typedArray.GetString(Resource.Styleable.LoadingView_loadingText);
typedArray.Recycle();
}