本文整理汇总了C#中Android.Graphics.Drawables.Drawable.SetCallback方法的典型用法代码示例。如果您正苦于以下问题:C# Drawable.SetCallback方法的具体用法?C# Drawable.SetCallback怎么用?C# Drawable.SetCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Graphics.Drawables.Drawable
的用法示例。
在下文中一共展示了Drawable.SetCallback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Init
private void Init ()
{
SetBackgroundColor (Color.White);
SetPadding (0, 0, 0, 0);
// Retrieve the drawable resource assigned to the Android.Resource.Attribute.SelectableItemBackground
// theme attribute from the current theme.
TypedArray a = Context.ObtainStyledAttributes (new[] { Android.Resource.Attribute.SelectableItemBackground });
_foregroundDrawable = a.GetDrawable (0);
_foregroundDrawable.SetCallback (this);
a.Recycle ();
}
示例2: Initialize
private void Initialize(Context context, IAttributeSet attrs,
int defStyle)
{
//set defaults first:
var circleColor = Resources.GetColor(Resource.Color.progress_default_circle_color);
var progressColor = Resources.GetColor(Resource.Color.progress_default_progress_color);
var pinnedDrawable = Resource.Drawable.pin_progress_pinned;
var unpinnedDrawable = Resource.Drawable.pin_progress_unpinned;
var shadowDrawable = Resource.Drawable.pin_progress_shadow;
var indeterminate = false;
var indeterminateInterval = Resources.GetInteger(Resource.Integer.progressbutton_indeterminent_interval);
var canChecked = false;
var canClickable = false;
var canFocusable = false;
m_InnerSize = Resources.GetDimensionPixelSize(Resource.Dimension.progress_inner_size);
if (context != null && attrs != null)
{
var a = context.ObtainStyledAttributes(attrs,
Resource.Styleable.ProgressButton,
Resource.Attribute.progressButtonStyle,
Resource.Style.ProgressButton_Pin);
m_Progress = a.GetInteger(Resource.Styleable.ProgressButton_progress, 0);
m_Max = a.GetInteger(Resource.Styleable.ProgressButton_max, 100);
circleColor = a.GetColor(Resource.Styleable.ProgressButton_circleColor, circleColor);
progressColor = a.GetColor(Resource.Styleable.ProgressButton_progressColor, progressColor);
pinnedDrawable = a.GetResourceId(Resource.Styleable.ProgressButton_pinnedDrawable, pinnedDrawable);
unpinnedDrawable = a.GetResourceId(Resource.Styleable.ProgressButton_unpinnedDrawable, unpinnedDrawable);
shadowDrawable = a.GetResourceId(Resource.Styleable.ProgressButton_shadowDrawable, shadowDrawable);
m_InnerSize = a.GetDimensionPixelSize(Resource.Styleable.ProgressButton_innerSize, 0);
if(m_InnerSize == 0)
m_InnerSize = Resources.GetDimensionPixelSize(Resource.Dimension.progress_inner_size);
canChecked = a.GetBoolean(Resource.Styleable.ProgressButton_pinned, canChecked);
canClickable = a.GetBoolean(Resource.Styleable.ProgressButton_android_clickable, canClickable);
canFocusable = a.GetBoolean(Resource.Styleable.ProgressButton_android_focusable, canFocusable);
SetBackgroundDrawable(a.GetDrawable(Resource.Styleable.ProgressButton_android_selectableItemBackground));
indeterminateInterval = a.GetInteger(Resource.Styleable.ProgressButton_indeterminate_interval, indeterminateInterval);
indeterminate = a.GetBoolean(Resource.Styleable.ProgressButton_indeterminate, indeterminate);
a.Recycle();
}
m_PinnedDrawable = Resources.GetDrawable(pinnedDrawable);
m_PinnedDrawable.SetCallback(this);
m_UnpinnedDrawable = Resources.GetDrawable(unpinnedDrawable);
m_UnpinnedDrawable.SetCallback(this);
m_ShadowDrawable = Resources.GetDrawable(shadowDrawable);
m_ShadowDrawable.SetCallback(this);
m_DrawableSize = m_ShadowDrawable.IntrinsicWidth;
Checked = canChecked;
Clickable = canClickable;
Focusable = canFocusable;
CirclePaint = new Paint {Color = circleColor, AntiAlias = true};
ProgressPaint = new Paint {Color = progressColor, AntiAlias = true};
m_IndeterminateInterval = indeterminateInterval;
Indeterminante = indeterminate;
}