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


C# ImageButton.SetImageDrawable方法代码示例

本文整理汇总了C#中ImageButton.SetImageDrawable方法的典型用法代码示例。如果您正苦于以下问题:C# ImageButton.SetImageDrawable方法的具体用法?C# ImageButton.SetImageDrawable怎么用?C# ImageButton.SetImageDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageButton的用法示例。


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

示例1: Initialize

        private void Initialize()
        {
            _playerName = FindViewById<TextView> (Resource.Id.playerInGameName);
            _playerPosition = FindViewById<TextView> (Resource.Id.playerInGamePostion);
            _playerScore = FindViewById<TextView> (Resource.Id.playerInGameScore);
            _makeThisButton = FindViewById<Button>(Resource.Id.makeThisButton);
            _refuseButton = FindViewById<Button>(Resource.Id.refuseButton);
            _cardImage = FindViewById<ImageButton>(Resource.Id.taskImageButton);
            _actionButton = (TextView)CreateActionButton (Resource.Drawable.table_button);
            _points = FindViewById<TextView> (Resource.Id.points);
            _x2 = FindViewById<TextView> (Resource.Id.x2);
            _taskEnumerator = (TaskEnumerator)Rep.Instance.Tasks.GetEnumerator ();

            _playerName.SetTypeface(this.MyriadProFont(MyriadPro.Bold),TypefaceStyle.Normal);
            _playerPosition.SetTypeface(this.MyriadProFont(MyriadPro.Regular),TypefaceStyle.Normal);
            _makeThisButton.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal);
            _refuseButton.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal);
            _playerScore.SetTypeface(this.MyriadProFont(MyriadPro.BoldCondensed), TypefaceStyle.Normal);
            _points.SetTypeface (this.MyriadProFont (MyriadPro.Bold), TypefaceStyle.Normal);
            _x2.SetTypeface (this.MyriadProFont (MyriadPro.Bold), TypefaceStyle.Normal);
            _cardImage.SetImageDrawable(Resources.GetDrawable(Resource.Drawable.card_backside));
            FindViewById<TextView>(Resource.Id.scoreString).SetTypeface(this.MyriadProFont(MyriadPro.Condensed), TypefaceStyle.Normal);
        }
开发者ID:okrotowa,项目名称:Yorsh,代码行数:23,代码来源:GameActivity.cs

示例2: AddActionButtonCompatFromMenuItem

		// Adds an action button to the compatibility action bar, using menu information from a
		// MenuItem. If the menu item ID is menu_refresh, the menu item's state
		// can be changed to show a loading spinner using
		// ActivityHelper#setRefreshActionButtonCompatState(boolean).
		private View AddActionButtonCompatFromMenuItem (IMenuItem item)
		{
			var action_bar = GetActionBarCompat ();

			if (action_bar == null)
				return null;

			// Create the separator
			var separator = new ImageView (activity, null, Resource.Attribute.actionbarCompatSeparatorStyle);
			separator.LayoutParameters = new ViewGroup.LayoutParams (2, ViewGroup.LayoutParams.FillParent);

			// Create the button
			var action_button = new ImageButton (activity, null, Resource.Attribute.actionbarCompatButtonStyle);
			action_button.LayoutParameters = new ViewGroup.LayoutParams ((int)activity.Resources.GetDimension (Resource.Dimension.actionbar_compat_height), ViewGroup.LayoutParams.FillParent);

			action_button.SetImageDrawable (item.Icon);
			action_button.SetScaleType (ImageView.ScaleType.Center);
			action_button.ContentDescriptionFormatted = item.TitleFormatted;
			action_button.Click += delegate {
				activity.OnMenuItemSelected ((int)WindowFeatures.OptionsPanel, item); };

			action_bar.AddView (separator);
			action_bar.AddView (action_button);

			if (item.ItemId == Resource.Id.menu_refresh) {
				// Refresh buttons should be stateful, and allow
				//  for indeterminate progress indicators,so add those.
				var width = activity.Resources.GetDimensionPixelSize (Resource.Dimension.actionbar_compat_height);
				width = width / 3;

				var indicator = new ProgressBar (activity, null, Resource.Attribute.actionbarCompatProgressIndicatorStyle);

				var layout = new LinearLayout.LayoutParams (width, width);
				layout.SetMargins (width, width, (width * 3) - 2 * width, 0);

				indicator.LayoutParameters = layout;
				indicator.Visibility = ViewStates.Gone;
				indicator.Id = Resource.Id.menu_refresh_progress;

				action_bar.AddView (indicator);
			}

			return action_button;
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:48,代码来源:ActivityHelper.cs

示例3: addActionItemCompatFromMenuItem

        /**
         * Adds an action button to the compatibility action bar, using menu information from a {@link
         * android.view.IMenuItem}. If the menu item ID is <code>menu_refresh</code>, the menu item's
         * state can be changed to show a loading spinner using
         * {@link com.example.android.actionbarcompat.ActionBarHelperBase#setRefreshActionItemState(bool)}.
         */
        private View addActionItemCompatFromMenuItem(IMenuItem item)
        {
            int itemId = item.ItemId;

            ViewGroup actionBar = getActionBarCompat();
            if (actionBar == null) {
                return null;
            }

            // Create the button
            ImageButton actionButton = new ImageButton(mActivity, null,
                    itemId == Resource.Id.home
                            ? Resource.attr.actionbarCompatItemHomeStyle
                            : Resource.attr.actionbarCompatItemStyle);
            actionButton.LayoutParameters = (new ViewGroup.LayoutParams(
                    (int) mActivity.getResources().getDimension(
                            itemId == android.Resource.Id.home
                                    ? Resource.dimen.actionbar_compat_button_home_width
                                    : Resource.dimen.actionbar_compat_button_width),
                    ViewGroup.LayoutParams.FILL_PARENT));
            if (itemId == Resource.Id.menuSync) {
                actionButton.Id = Resource.Id.actionbar_compat_item_refresh;
            }
            actionButton.SetImageDrawable(item.Icon);
            actionButton.SetScaleType(ImageView.ScaleType.Center);
            actionButton.ContentDescription = item.TitleFormatted;
            //	        actionButton.setOnClickListener(new View.OnClickListener() {
            //	            public void onClick(View view) {
            //	                mActivity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, item);
            //	            }
            //	        });

            actionBar.AddView(actionButton);

            if (item.ItemId == Resource.Id.menuSync) {
                // Refresh buttons should be stateful, and allow for indeterminate progress indicators,
                // so add those.
                ProgressBar indicator = new ProgressBar(mActivity, null,
                        Resource.attr.actionbarCompatProgressIndicatorStyle);

                int buttonWidth = mActivity.Resources.GetDimensionPixelSize(
                        Resource.dimen.actionbar_compat_button_width);
                int buttonHeight = mActivity.Resources.GetDimensionPixelSize(
                        Resource.dimen.actionbar_compat_height);
                int progressIndicatorWidth = buttonWidth / 2;

                LinearLayout.LayoutParams indicatorLayoutParams = new LinearLayout.LayoutParams(
                        progressIndicatorWidth, progressIndicatorWidth);
                indicatorLayoutParams.SetMargins(
                        (buttonWidth - progressIndicatorWidth) / 2,
                        (buttonHeight - progressIndicatorWidth) / 2,
                        (buttonWidth - progressIndicatorWidth) / 2,
                        0);
                indicator.LayoutParameters = indicatorLayoutParams;
                indicator.Visibility = ViewStates.Gone;
                indicator.Id = Resource.Id.actionbar_compat_item_refresh_progress;
                actionBar.AddView(indicator);
            }

            return actionButton;
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:67,代码来源:ActionBarHelperBase.cs


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