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


C# Drawable.SetCallback方法代码示例

本文整理汇总了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 ();
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:12,代码来源:TouchHighlightImageButton.cs

示例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;
        }
开发者ID:jamesmontemagno,项目名称:MonoDroidToolkit,代码行数:70,代码来源:ProgressButton.cs


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