當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。