public RotatedTextView(Context context, IAttributeSet attrs) : base(context, attrs, 0) { TypedArray typedArray = context.ObtainStyledAttributes(attrs, Resource.Styleable.RotatedTextView); //mColor = typedArray.GetColor(Resource.Styleable.RotatedTextView_customColor, Color.Red); if (typedArray.GetText(Resource.Styleable.RotatedTextView_customText) != null) { mText = typedArray.GetText(Resource.Styleable.RotatedTextView_customText).ToString(); } typedArray.Recycle(); }
/** * Parse attributes during inflation from a view hierarchy into the * arguments we handle. */ public override void OnInflate(global::Android.App.Activity activity, IAttributeSet attrs, Bundle savedInstanceState) { base.OnInflate(activity, attrs, savedInstanceState); TypedArray a = activity.ObtainStyledAttributes(attrs, R.Styleables.FragmentArguments.AllIds); mLabel = a.GetText(R.Styleables.FragmentArguments.label & 0xFFFF); a.Recycle(); }
public TagGroup(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr) { default_border_stroke_width = dp2px(0.5f); default_text_size = sp2px(13.0f); default_horizontal_spacing = dp2px(8.0f); default_vertical_spacing = dp2px(4.0f); default_horizontal_padding = dp2px(12.0f); default_vertical_padding = dp2px(3.0f); // Load styled attributes. TypedArray a = context.ObtainStyledAttributes(attrs, Resource.Styleable.TagGroup, defStyleAttr, Resource.Style.TagGroup); try { isAppendMode = a.GetBoolean(Resource.Styleable.TagGroup_atg_isAppendMode, false); inputHint = a.GetText(Resource.Styleable.TagGroup_atg_inputHint); borderColor = a.GetColor(Resource.Styleable.TagGroup_atg_borderColor, default_border_color); textColor = a.GetColor(Resource.Styleable.TagGroup_atg_textColor, default_text_color); backgroundColor = a.GetColor(Resource.Styleable.TagGroup_atg_backgroundColor, default_background_color); dashBorderColor = a.GetColor(Resource.Styleable.TagGroup_atg_dashBorderColor, default_dash_border_color); inputHintColor = a.GetColor(Resource.Styleable.TagGroup_atg_inputHintColor, default_input_hint_color); inputTextColor = a.GetColor(Resource.Styleable.TagGroup_atg_inputTextColor, default_input_text_color); checkedBorderColor = a.GetColor(Resource.Styleable.TagGroup_atg_checkedBorderColor, default_checked_border_color); checkedTextColor = a.GetColor(Resource.Styleable.TagGroup_atg_checkedTextColor, default_checked_text_color); checkedMarkerColor = a.GetColor(Resource.Styleable.TagGroup_atg_checkedMarkerColor, default_checked_marker_color); checkedBackgroundColor = a.GetColor(Resource.Styleable.TagGroup_atg_checkedBackgroundColor, default_checked_background_color); pressedBackgroundColor = a.GetColor(Resource.Styleable.TagGroup_atg_pressedBackgroundColor, default_pressed_background_color); borderStrokeWidth = a.GetDimension(Resource.Styleable.TagGroup_atg_borderStrokeWidth, default_border_stroke_width); textSize = a.GetDimension(Resource.Styleable.TagGroup_atg_textSize, default_text_size); horizontalSpacing = (int)a.GetDimension(Resource.Styleable.TagGroup_atg_horizontalSpacing, default_horizontal_spacing); verticalSpacing = (int)a.GetDimension(Resource.Styleable.TagGroup_atg_verticalSpacing, default_vertical_spacing); horizontalPadding = (int)a.GetDimension(Resource.Styleable.TagGroup_atg_horizontalPadding, default_horizontal_padding); verticalPadding = (int)a.GetDimension(Resource.Styleable.TagGroup_atg_verticalPadding, default_vertical_padding); } finally { a.Recycle(); } if (isAppendMode) { // Append the initial INPUT tag. appendInputTag(); Click += (sender, e) => { submitTag(); }; } }
public string GetText(int index) { return(_array.GetText(index)); }