本文整理汇总了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);
}
示例2: CircularImageView
public CircularImageView(Context context, IAttributeSet attrs, int defStyle)
: base(context, attrs, defStyle)
{
this._attrs = attrs;
this._defStyle = defStyle;
Init();
}
示例3: ProgressButton
public ProgressButton(Context context, IAttributeSet attrs,
int defStyle)
: base(context, attrs, defStyle)
{
ResourceIdManager.UpdateIdValues();
Initialize(context, attrs, defStyle);
}
示例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;
}
示例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();
}
}
示例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;
}
示例7: CustomViewBehind
public CustomViewBehind(Context context, IAttributeSet attrs)
: base(context, attrs)
{
TouchMode = TouchMode.Margin;
MarginThreshold =
(int) TypedValue.ApplyDimension(ComplexUnitType.Dip, MARGIN_THRESHOLD, Resources.DisplayMetrics);
}
示例8: BindableViewPager
public BindableViewPager(Context context, IAttributeSet attrs, MvxBindablePagerAdapter adapter)
: base(context, attrs)
{
var itemTemplateId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs);
adapter.ItemTemplateId = itemTemplateId;
Adapter = adapter;
}
示例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();
}
示例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;
}
}
}
示例11: BandThemeView
public BandThemeView(Context context, IAttributeSet attrs)
: base(context, attrs)
{
var inflater = LayoutInflater.From(context);
inflater.Inflate(Resource.Layout.view_bandtheme, this);
LoadViews();
}
示例12: NormalGameView
public NormalGameView(Context context, IAttributeSet attrs, int defStyle)
: base(context, attrs, defStyle)
{
GraphicMode = false;
InitGameView ();
screenEvents = new ScreenEvents (this);
}
示例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;
}
示例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 ();
}
示例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);
}