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


C# TextView.SetBackgroundDrawable方法代码示例

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


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

示例1: NodeClick

        /**
         * 节点浏览示例
         * @param v
         */
        public void NodeClick(View v)
        {

            if (nodeIndex < -1 || route == null || nodeIndex >= route.NumSteps)
                return;
            viewCache = LayoutInflater.Inflate(Resource.Layout.custom_text_view, null);
            popupText = viewCache.FindViewById<TextView>(Resource.Id.textcache);
            //上一个节点
            if (mBtnPre.Equals(v) && nodeIndex > 0)
            {
                //索引减
                nodeIndex--;
                //移动到指定索引的坐标
                mMapView.Controller.AnimateTo(route.GetStep(nodeIndex).Point);
                //弹出泡泡
                popupText.Text = route.GetStep(nodeIndex).Content;
                popupText.SetBackgroundResource(Resource.Drawable.popup);
                pop.ShowPopup(BMapUtil.GetBitmapFromView(popupText),
                        route.GetStep(nodeIndex).Point,
                        5);
            }
            //下一个节点
            if (mBtnNext.Equals(v) && nodeIndex < (route.NumSteps - 1))
            {
                //索引加
                nodeIndex++;
                //移动到指定索引的坐标
                mMapView.Controller.AnimateTo(route.GetStep(nodeIndex).Point);
                //弹出泡泡
                popupText.Text = route.GetStep(nodeIndex).Content;
                popupText.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.popup));
                pop.ShowPopup(BMapUtil.GetBitmapFromView(popupText),
                        route.GetStep(nodeIndex).Point,
                        5);
            }
        }
开发者ID:hnhhzy,项目名称:BaiduMap_SDK_DEMO_for_Xamarin.Android,代码行数:40,代码来源:BusLineSearchDemo.cs

示例2: SetTheme

		public static void SetTheme(TextView textView, FlatTheme theme,
			FlatUI.FlatFontFamily fontFamily, FlatUI.FlatFontWeight fontWeight, int textColor, int backgroundColor,
			int customBackgroundColor, int cornerRadius)
		{

			if (backgroundColor != -1)
			{
				var bgColor = theme.DarkAccentColor;

				if (backgroundColor == 0)
					bgColor = theme.DarkAccentColor;
				else if (backgroundColor == 1)
					bgColor = theme.BackgroundColor;
				else if (backgroundColor == 2)
					bgColor = theme.LightAccentColor;
				else if (backgroundColor == 3)
					bgColor = theme.VeryLightAccentColor;

				GradientDrawable gradientDrawable = new GradientDrawable();
				gradientDrawable.SetColor(bgColor);
				gradientDrawable.SetCornerRadius(cornerRadius);
				textView.SetBackgroundDrawable(gradientDrawable);
			} 
			else if (customBackgroundColor != -1) 
			{
				var bgColor = theme.DarkAccentColor;

				if (customBackgroundColor == 0)
					bgColor = theme.DarkAccentColor;
				else if (customBackgroundColor == 1)
					bgColor = theme.BackgroundColor;
				else if (customBackgroundColor == 2)
					bgColor = theme.LightAccentColor;
				else if (customBackgroundColor == 3)
					bgColor = theme.VeryLightAccentColor;

				GradientDrawable gradientDrawable = new GradientDrawable();
				gradientDrawable.SetColor(bgColor);
				gradientDrawable.SetCornerRadius(cornerRadius);
				textView.SetBackgroundDrawable(gradientDrawable);
			}

			var txtColor = theme.VeryLightAccentColor;
			if (textColor == 0)
				txtColor = theme.DarkAccentColor;
			if (textColor == 1)
				txtColor = theme.BackgroundColor;
			if (textColor == 2)
				txtColor = theme.LightAccentColor;
			if (textColor == 3)
				txtColor = theme.VeryLightAccentColor;

			textView.SetTextColor(txtColor);

			var typeface = FlatUI.GetFont(textView.Context, fontFamily, fontWeight);
			if (typeface != null)
				textView.SetTypeface(typeface, TypefaceStyle.Normal);
		}
开发者ID:kuruminbr,项目名称:FlatUI.Xamarin.Android,代码行数:58,代码来源:FlatTextView.cs

示例3: Init

        private void Init()
        {
            RemoveAllViews();
 
            Orientation = Orientation.Horizontal;

            LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            lp.Gravity = GravityFlags.CenterVertical;
            LayoutParameters = lp;

            cardImageLayout = new FrameLayout(Context);

            LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            cardImageLayoutParams.Gravity = GravityFlags.CenterVertical;
            cardImageLayout.LayoutParameters = cardImageLayoutParams;

            cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0);

            SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2);

            cv2TextView = new CV2TextView(Context);

            LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            parameters.Weight = 1;
            parameters.Gravity = GravityFlags.Center;

            cv2TextView.LayoutParameters = parameters;

            cv2TextView.OnEntryComplete += cardNumber =>
            {
                if (OnCreditCardEntered != null)
                {
                    OnCreditCardEntered(cardNumber);
                }
            };

            LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent);
            textViewLayoutParams.Gravity = GravityFlags.Center;

            last4CCNosTextView = new TextView(Context);
            last4CCNosTextView.Gravity = GravityFlags.Center;
            last4CCNosTextView.Text = "0000";
            last4CCNosTextView.LayoutParameters = textViewLayoutParams;
            last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            last4CCNosTextView.TextSize = 18;
            last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text));
            last4CCNosTextView.Focusable = false;
            last4CCNosTextView.Enabled = false;
            last4CCNosTextView.SetSingleLine();
            last4CCNosTextView.SetBackgroundDrawable(null);

            AddView(cardImageLayout);
            AddView(last4CCNosTextView);
            AddView(cv2TextView);
        }
开发者ID:TheJaniceTong,项目名称:Judo-Xamarin,代码行数:55,代码来源:CV2EntryView.cs


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