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


C# IAttributeSet类代码示例

本文整理汇总了C#中IAttributeSet的典型用法代码示例。如果您正苦于以下问题:C# IAttributeSet类的具体用法?C# IAttributeSet怎么用?C# IAttributeSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ForwardNavigationMenu

        public ForwardNavigationMenu(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            _mainContainer = new LinearLayout (context);
            _mainContainer.Orientation = Android.Widget.Orientation.Vertical;
            _mainContainer.LayoutParameters = new LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent);
            _context = context;

            var dm = Resources.DisplayMetrics;
            textSize = (int)TypedValue.ApplyDimension (ComplexUnitType.Sp, textSize, dm);

            var a = context.ObtainStyledAttributes (attrs, Attrs);

            a = context.ObtainStyledAttributes (attrs, Resource.Styleable.ForwardNavigationMenu);
            contentPadding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmContentPadding, contentPadding);
            padding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPadding, padding);
            paddingLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingLeft, paddingLeft);
            paddingBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingBottom, paddingBottom);
            paddingRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingRight, paddingRight);
            paddingTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingTop, paddingTop);

            margin = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMargin, margin);
            marginRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginRight, marginRight);
            marginLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginLeft, marginLeft);
            marginBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginBottom, marginBottom);
            marginTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginTop, marginTop);

            typefaceStyle = (TypefaceStyle)a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextStyle, (int)TypefaceStyle.Normal);
            textAlpha = a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextAlpha, textAlpha);
            a.Recycle ();

            _mainContainer.SetPadding (contentPadding, contentPadding, contentPadding, contentPadding);
            AddView (_mainContainer);
        }
开发者ID:Nininea,项目名称:ForwardNavigationMenu,代码行数:34,代码来源:ForwardNavigationMenu.cs

示例2: CircularImageView

 public CircularImageView(Context context, IAttributeSet attrs, int defStyle)
     : base(context, attrs, defStyle)
 {
     this._attrs = attrs;
     this._defStyle = defStyle;
     Init();
 }
开发者ID:EckyZero,项目名称:Hashtagg,代码行数:7,代码来源:CircularImageView.cs

示例3: ProgressButton

 public ProgressButton(Context context, IAttributeSet attrs,
     int defStyle)
     : base(context, attrs, defStyle)
 {
     ResourceIdManager.UpdateIdValues();
     Initialize(context, attrs, defStyle);
 }
开发者ID:jamesmontemagno,项目名称:MonoDroidToolkit,代码行数:7,代码来源:ProgressButton.cs

示例4: MvxAutoCompleteTextView

 public MvxAutoCompleteTextView(Context context, IAttributeSet attrs)
     : this(context, attrs, new MvxFilteringAdapter(context))
 {
     // note - we shouldn't realy need both of these... but we do
     this.ItemClick += OnItemClick;
     this.ItemSelected += OnItemSelected;
 }
开发者ID:talisqualis,项目名称:MvvmCross-Build,代码行数:7,代码来源:MvxAutoCompleteTextView.cs

示例5: CircleImageView

		public CircleImageView(Context context, IAttributeSet attrs, int defStyle)
			: base(context, attrs, defStyle)
		{

			// init paint
			paint = new Paint();
			paint.AntiAlias = true;

			paintBorder = new Paint();
			paintBorder.AntiAlias = true;

			// load the styled attributes and set their properties
			TypedArray attributes = context.ObtainStyledAttributes(attrs, Resource.Styleable.CircularImageView, defStyle, 0);

			if (attributes.GetBoolean(Resource.Styleable.CircularImageView_border, true))
			{
				int defaultBorderSize = (int)(4 * context.Resources.DisplayMetrics.Density+ 0.5f);
				BorderWidth = attributes.GetDimensionPixelOffset(Resource.Styleable.CircularImageView_border_width, defaultBorderSize);
				BorderColor = attributes.GetColor(Resource.Styleable.CircularImageView_border_color, Color.White);
			}

			if (attributes.GetBoolean(Resource.Styleable.CircularImageView_shadow, false))
			{
				addShadow();
			}
		}
开发者ID:scrafty614,项目名称:XamarinStudio_Example,代码行数:26,代码来源:CircleImageView.cs

示例6: init

		private void init(IAttributeSet attrs) {
			TypedArray a = Context.ObtainStyledAttributes (attrs, Resource.Styleable.ColorPickerPreference);

			showDialogTitle = a.GetBoolean(Resource.Styleable.ColorPickerPreference_showDialogTitle, false);
			showPreviewSelectedColorInList = a.GetBoolean(Resource.Styleable.ColorPickerPreference_showSelectedColorInList, true);

			a.Recycle();	
			a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.ColorPickerView);

			alphaChannelVisible = a.GetBoolean(Resource.Styleable.ColorPickerView_alphaChannelVisible, false);
			alphaChannelText = a.GetString(Resource.Styleable.ColorPickerView_alphaChannelText);		
			colorPickerSliderColor = a.GetColor(Resource.Styleable.ColorPickerView_colorPickerSliderColor, -1);
			colorPickerBorderColor = a.GetColor(Resource.Styleable.ColorPickerView_colorPickerBorderColor, -1);

			a.Recycle();

			if(showPreviewSelectedColorInList) {

				WidgetLayoutResource = Resource.Layout.preference_preview_layout;
			}

			if(!showDialogTitle) {
				DialogTitle = null;
			}

			DialogLayoutResource = Resource.Layout.dialog_color_picker;
			   

			SetPositiveButtonText(Resource.String.dialog_ok);
			SetNegativeButtonText(Resource.String.dialog_cancle);		

			Persistent = true;
			 
		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:34,代码来源:ColorPickerPreference.cs

示例7: CustomViewBehind

 public CustomViewBehind(Context context, IAttributeSet attrs) 
     : base(context, attrs)
 {
     TouchMode = TouchMode.Margin;
     MarginThreshold =
         (int) TypedValue.ApplyDimension(ComplexUnitType.Dip, MARGIN_THRESHOLD, Resources.DisplayMetrics);
 }
开发者ID:mamta-bisht,项目名称:SlidingMenuSharp,代码行数:7,代码来源:CustomViewBehind.cs

示例8: BindableViewPager

 public BindableViewPager(Context context, IAttributeSet attrs, MvxBindablePagerAdapter adapter)
     : base(context, attrs)
 {
     var itemTemplateId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs);
     adapter.ItemTemplateId = itemTemplateId;
     Adapter = adapter;
 }
开发者ID:kunni80,项目名称:Cheesebaron.MvvmCross.Bindings,代码行数:7,代码来源:BindableViewPager.cs

示例9: RoundedImageView

        public RoundedImageView(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.RoundedImageView, defStyle, 0);

            int index = a.GetInt(Resource.Styleable.RoundedImageView_android_scaleType, -1);
            SetScaleType(index >= 0 ? ScaleTypes[index] : ScaleType.FitCenter);

            _cornerRadius = a.GetDimensionPixelSize(Resource.Styleable.RoundedImageView_corner_radius, -1);
            _borderWidth = a.GetDimensionPixelSize(Resource.Styleable.RoundedImageView_border_width, -1);

            // don't allow negative values for radius and border
            if (_cornerRadius < 0)
            {
                _cornerRadius = DefaultRadius;
            }
            if (_borderWidth < 0)
            {
                _borderWidth = DefaultBorderWidth;
            }

            _borderColor = a.GetColorStateList(Resource.Styleable.RoundedImageView_border_color) ??
                           ColorStateList.ValueOf(Color.Black);

            _mutateBackground = a.GetBoolean(Resource.Styleable.RoundedImageView_mutate_background, false);
            _isOval = a.GetBoolean(Resource.Styleable.RoundedImageView_oval, false);

            UpdateDrawableAttrs();
            UpdateBackgroundDrawableAttrs(true);

            a.Recycle();
        }
开发者ID:herrskytte,项目名称:RoundedImageView,代码行数:32,代码来源:RoundedImageView.cs

示例10: GridView

        public GridView(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.GridView, defStyle, 0);

            int markupId = a.GetResourceId(Resource.Styleable.GridView_grid_markup, DefaultGridMarkupValue);
            if(markupId != DefaultGridMarkupValue)
            {
                ParseMarkupXml(markupId);
            }
            else
            {
                _rowDefinitions.Add(new GridDefinition());
                _columnDefinitions.Add(new GridDefinition());
            }
            foreach(var row in _rowDefinitions)
            {
                var rowInfo = new GridDefinitionMeasureInfo(row);
                _rowsInfo.Add(row, rowInfo);
                if(row.Length.IsStar)
                {
                    _heightStarSum += row.Length.Value;
                }
            }
            foreach(var column in _columnDefinitions)
            {
                var columnInfo = new GridDefinitionMeasureInfo(column);
                _columnsInfo.Add(column, columnInfo);
                if(column.Length.IsStar)
                {
                    _widthStarSum += column.Length.Value;
                }
            }
        }
开发者ID:ZuZuK,项目名称:GridView,代码行数:34,代码来源:GridView.cs

示例11: BandThemeView

 public BandThemeView(Context context, IAttributeSet attrs) 
     : base(context, attrs)
 {
     var inflater = LayoutInflater.From(context);
     inflater.Inflate(Resource.Layout.view_bandtheme, this);
     LoadViews();
 }
开发者ID:King-of-Spades,项目名称:xamarin-samples,代码行数:7,代码来源:BandThemeView.cs

示例12: NormalGameView

 public NormalGameView(Context context, IAttributeSet attrs, int defStyle)
     : base(context, attrs, defStyle)
 {
     GraphicMode = false;
     InitGameView ();
     screenEvents = new ScreenEvents (this);
 }
开发者ID:adlair,项目名称:Projects,代码行数:7,代码来源:NormalGameView.cs

示例13: ParseAttributes

        /// <summary>
        /// Parses the binding attributes into MvxViewBindingTag.
        /// </summary>
        /// <returns>The tag with parsed values, null if no binding attributes found.</returns>
        protected MvxViewBindingTag ParseAttributes (Context context, IAttributeSet attrs)
        {
            var res = MvxAndroidBindingResource.Instance;
            IEnumerable<MvxBindingDescription> descriptions = null;

            using (var typedArray = context.ObtainStyledAttributes(
                    attrs, res.BindingStylableGroupId)) {

                int numStyles = typedArray.IndexCount;
                for (var i = 0; i < numStyles; ++i) {
                    var attributeId = typedArray.GetIndex (i);

                    if (attributeId == res.BindingBindId) {
                        try {
                            var bindingText = typedArray.GetString (attributeId);
                            descriptions = this.GetService<IMvxBindingDescriptionParser> ().Parse (bindingText);
                        } catch (Exception exception) {
                            MvxBindingTrace.Trace (
                                MvxTraceLevel.Error, "Exception thrown during the parsing the bindings {0}",
                                exception.ToLongString ());
                            throw;
                        }
                    }
                }
                typedArray.Recycle ();
            }

            if (descriptions != null) {
                return new MvxViewBindingTag (descriptions);
            }
            return null;
        }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:36,代码来源:MvxBindingInflater.cs

示例14: ApplyCustomFont

        //applies font from XML
        public static void ApplyCustomFont(TextView view, Context context, IAttributeSet attrs)
        {
            TypedArray attributeArray = context.ObtainStyledAttributes (attrs, Resource.Styleable.CustomFont);

            string fontName = attributeArray.GetString (Resource.Styleable.CustomFont_font);
            int textStyle = attrs.GetAttributeIntValue (ANDROID_SCHEMA, "textStyle", 0);

            Typeface customFont = SelectTypeface (context, fontName);

            switch (textStyle) {
            case 1:
                view.SetTypeface (customFont, TypefaceStyle.Bold);
                break;
            case 2:
                view.SetTypeface (customFont, TypefaceStyle.Italic);
                break;
            case 3:
                view.SetTypeface (customFont, TypefaceStyle.BoldItalic);
                break;
            default:
                view.SetTypeface (customFont, TypefaceStyle.Normal);
                break;
            }

            attributeArray.Recycle ();
        }
开发者ID:FrederickEskens,项目名称:Totem,代码行数:27,代码来源:CustomFontHelper.cs

示例15: LinePageIndicator

        public LinePageIndicator(Context context, IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            if(IsInEditMode) return;

            var res = Resources;

            //Load defaults from resources
            var defaultSelectedColor = res.GetColor(Resource.Color.default_line_indicator_selected_color);
            var defaultUnselectedColor = res.GetColor(Resource.Color.default_line_indicator_unselected_color);
            var defaultLineWidth = res.GetDimension(Resource.Dimension.default_line_indicator_line_width);
            var defaultGapWidth = res.GetDimension(Resource.Dimension.default_line_indicator_gap_width);
            var defaultStrokeWidth = res.GetDimension(Resource.Dimension.default_line_indicator_stroke_width);
            var defaultCentered = res.GetBoolean(Resource.Boolean.default_line_indicator_centered);

            //Retrive styles attributes
            var a = context.ObtainStyledAttributes(attrs, Resource.Styleable.LinePageIndicator, defStyle, 0);
            _centered = a.GetBoolean(Resource.Styleable.LinePageIndicator_centered, defaultCentered);
            _lineWidth = a.GetDimension(Resource.Styleable.LinePageIndicator_lineWidth, defaultLineWidth);
            _gapWidth = a.GetDimension(Resource.Styleable.LinePageIndicator_gapWidth, defaultGapWidth);
            StrokeWidth = a.GetDimension(Resource.Styleable.LinePageIndicator_strokeWidth, defaultStrokeWidth);
            _paintUnSelected.Color = a.GetColor(Resource.Styleable.LinePageIndicator_unselectedColor,
                                                defaultUnselectedColor);
            _paintSelected.Color = a.GetColor(Resource.Styleable.LinePageIndicator_selectedColor, defaultSelectedColor);

            var background = a.GetDrawable(Resource.Styleable.LinePageIndicator_android_background);
            if (null != background)
                Background = background;

            a.Recycle();

            var configuration = ViewConfiguration.Get(context);
            _touchSlop = ViewConfigurationCompat.GetScaledPagingTouchSlop(configuration);
        }
开发者ID:SeeD-Seifer,项目名称:ViewPagerIndicator,代码行数:34,代码来源:LinePageIndicator.cs


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