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


C# Android.ObtainStyledAttributes方法代码示例

本文整理汇总了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);
        }
开发者ID:devxiaruwei,项目名称:MaterialProgressbar,代码行数:33,代码来源:CircleProgressBar.cs

示例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();
 }
开发者ID:huguodong,项目名称:XamandroidSupportDesign22.2.0.0,代码行数:6,代码来源:LoadingView.cs


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