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


C# TextView.SetTextColor方法代码示例

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


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

示例1: UpdateTextColor

		public void UpdateTextColor(TextView control, Color color)
		{
			if (color == _currentTextColor)
				return;

			_currentTextColor = color;

			if (color.IsDefault)
				control.SetTextColor(_defaultTextColors);
			else
			{
				// Set the new enabled state color, preserving the default disabled state color
				int defaultDisabledColor = _defaultTextColors.GetColorForState(s_colorStates[1], color.ToAndroid());
				control.SetTextColor(new ColorStateList(s_colorStates, new[] { color.ToAndroid().ToArgb(), defaultDisabledColor }));
			}
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:16,代码来源:TextColorSwitcher.cs

示例2: CreateLayout

        private void CreateLayout()
        {
            // Create a new vertical layout for the app
            var layout = new LinearLayout(this) { Orientation = Orientation.Vertical };

            // Create a label for showing the load status for the public service
            _publicLayerLabel = new TextView(this);
            _publicLayerLabel.Text = PublicLayerName;
            _publicLayerLabel.TextSize = 12;
            _publicLayerLabel.SetTextColor(Color.Gray);
            layout.AddView(_publicLayerLabel);

            // Create a label to show the load status of the secured layer
            _secureLayerLabel = new TextView(this);
            _secureLayerLabel.Text = SecureLayerName;
            _secureLayerLabel.TextSize = 12;
            _secureLayerLabel.SetTextColor(Color.Gray);
            layout.AddView(_secureLayerLabel);

            // Add the map view to the layout
            layout.AddView(_myMapView);

            // Show the layout in the app
            SetContentView(layout);
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:25,代码来源:MainActivity.cs

示例3: GetCustomTabView

 public View GetCustomTabView(ViewGroup p0, int p1)
 {
     var txt = new TextView(p0.Context);
     txt.SetTextColor(new Color(ResourceExtension.BrushText));
     txt.Tag = p1;
     switch (p1)
     {
         case 0:
             txt.Text = "General";
             break;
         case 1:
             txt.Text = "Details";
             break;
         case 2:
             txt.Text = "Reviews";
             break;
         case 3:
             txt.Text = "Recoms";
             break;
         case 4:
             txt.Text = "Related";
             break;
     }
     
     return txt;
 }
开发者ID:Mordonus,项目名称:MALClient,代码行数:26,代码来源:AnimeDetailsPagerAdapter.cs

示例4: Initialize

		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.Center);


			image = new RelativeLayout(context);
			txtDescription = new TextView (context);
			txtTitle = new TextView (context);
			background = new LinearLayout (context);

			image.SetGravity (GravityFlags.Center);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));
			background.Orientation = Orientation.Vertical;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			txtDescription.SetTextColor(Color.ParseColor("#ffffff"));
			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			txtDescription.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));

			background.AddView (txtTitle);
			background.AddView (txtDescription);



			image.AddView (background);

			this.AddView (image);
			//this.AddView (background);


		}
开发者ID:Milton761,项目名称:MLRepo,代码行数:35,代码来源:CustomerImageView.cs

示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var display = WindowManager.DefaultDisplay;
            var horiPager = new HorizontalPager(this.ApplicationContext, display);
            horiPager.ScreenChanged += new ScreenChangedEventHandler(horiPager_ScreenChanged);

            //You can also use:
            /*horiPager.ScreenChanged += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine("Switched to screen: " + ((HorizontalPager)sender).CurrentScreen);
            };*/

            var backgroundColors = new Color[] { Color.Red, Color.Blue, Color.Cyan, Color.Green, Color.Yellow };

            for (int i = 0; i < 5; i++)
            {
                var textView = new TextView(this.ApplicationContext);
                textView.Text = (i + 1).ToString();
                textView.TextSize = 100;
                textView.SetTextColor(Color.Black);
                textView.Gravity = GravityFlags.Center;
                textView.SetBackgroundColor(backgroundColors[i]);
                horiPager.AddView(textView);
            }

            SetContentView(horiPager);
        }
开发者ID:Cheesebaron,项目名称:MonoDroid.HorizontalPager,代码行数:28,代码来源:HorizontalPagerDemo.cs

示例6: BasicPackageManagerView

        public BasicPackageManagerView(Context context)
            : base(context, Resource.Drawable.icon_menu_round)
        {
            // Initialize & style Status label
            StatusLabel = new TextView(context);
            StatusLabel.SetTextColor(Color.Black);

            GradientDrawable background = new GradientDrawable();
            background.SetCornerRadius(5);
            background.SetColor(Color.Argb(160, 255, 255, 255));
            StatusLabel.Background = background;

            StatusLabel.Gravity = Android.Views.GravityFlags.Center;
            StatusLabel.Typeface = Typeface.Create("HelveticaNeue", TypefaceStyle.Normal);

            DisplayMetrics screen = Resources.DisplayMetrics;

            int width = screen.WidthPixels / 2;
            int height = width / 4;

            int x = screen.WidthPixels / 2 - width / 2;
            int y = screen.HeightPixels / 100;

            var parameters = new RelativeLayout.LayoutParams(width, height);
            parameters.TopMargin = y;
            parameters.LeftMargin = x;

            AddView(StatusLabel, parameters);

            Menu = new CityChoiceMenu(context);
            AddView(Menu);
        }
开发者ID:CartoDB,项目名称:mobile-dotnet-samples,代码行数:32,代码来源:BasicPackageManagerView.cs

示例7: AddItem

        //here we only have img and text for each item
        //create a RelativeLayout and add it to dic
        //squear image
        public void AddItem(int imgresource,string text,Action OnCellClick)
        {
            RelativeLayout menucell = new RelativeLayout (nn_context);
            menucell.SetPadding (TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding),TapUtil.dptodx(padding));
            menucell.LayoutParameters = new LinearLayout.LayoutParams (TapUtil.dptodx(cellwidth),TapUtil.dptodx(cellheight));
            menucell.Click+= (object sender, EventArgs e) => {

                if(OnCellClick!=null){
                    OnCellClick();
                }
            };

            ImageView img = new ImageView (nn_context);
            img.Id = TapUtil.generateViewId ();
            img.LayoutParameters = new RelativeLayout.LayoutParams (TapUtil.dptodx(imagewidth),TapUtil.dptodx(imagewidth));
            //			Bitmap.CreateScaledBitmap(imgresource, TapUtil.dptodx(imagewidth), TapUtil.dptodx(imageheight), false);
            img.SetImageResource (imgresource);
            img.SetBackgroundColor (Color.White);

            TextView textview = new TextView (nn_context);
            RelativeLayout.LayoutParams textviewparam=new RelativeLayout.LayoutParams (TapUtil.dptodx(textwidth),TapUtil.dptodx(textheight));
            textviewparam.AddRule(LayoutRules.RightOf,img.Id);
            textviewparam.LeftMargin = TapUtil.dptodx (space);
            textview.LayoutParameters =textviewparam;
            textview.Text = text;
            textview.SetTypeface (Typeface.Default, TypefaceStyle.Bold);
            textview.SetTextColor(Color.Black);
            textview.Gravity = global::Android.Views.GravityFlags.Center;

            menucell.AddView (img);
            menucell.AddView (textview);

            nn_itemlist.Add (menucell);
        }
开发者ID:MADMUC,项目名称:TAP5050,代码行数:37,代码来源:Tap5050MenuBuilder.cs

示例8: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.RecipeView);

            //this.Recid = CachedData.Instance.mostRecentRecSel;

            /*//MENU VIEW
            Button menu_button = FindViewById<Button> (Resource.Id.menu_button);
            menu_button.Click += (s, arg) => {
                menu_button.SetBackgroundResource(Resource.Drawable.pressed_lines);
                PopupMenu menu = new PopupMenu (this, menu_button);
                menu.Inflate (Resource.Menu.Main_Menu);
                menu.MenuItemClick += this.MenuButtonClick;
                menu.DismissEvent += (s2, arg2) => {
                    menu_button.SetBackgroundResource(Resource.Drawable.menu_lines);
                    Console.WriteLine ("menu dismissed");
                };
                menu.Show ();
            };*/
            int varTest = CachedData.Instance.mostRecentRecSel;
            Recipe recipe = WebUtils.getRecipeViewInfo (varTest);
            System.Diagnostics.Debug.WriteLine (recipe.title);
            FindViewById<TextView> (Resource.Id.recipe_view_title).Text = recipe.title;
            //FindViewById<TextView> (Resource.Id.recipe_view_time).Text = recipe.time + " minutes";

            ViewGroup ingredientView = (ViewGroup) FindViewById (Resource.Id.recipe_view_ingredients);

            for (int i = 0; i < recipe.ingredients.Length; i++) {
                Console.WriteLine ("Adding Ingredient " + recipe.ingredients [i]);
                TextView tv = new TextView (this);
                //tv.Visibility = ViewStates.Visible;
                //tv.TextSize = 20;
                tv.SetTextColor (Resources.GetColor(Resource.Color.gray_icon));
                tv.TextSize = 14;
                tv.Text = recipe.ingredients [i];
                ingredientView.AddView (tv);
            }

            ViewGroup taskView = (ViewGroup) FindViewById (Resource.Id.recipe_view_steps);

            for (int i = 0; i < recipe.tasks.Length; i++) {
                Console.WriteLine ("Adding Step " + recipe.tasks [i]);
                TextView tv = new TextView (this);
                tv.SetTextColor (Resources.GetColor(Resource.Color.gray_icon));
                tv.TextSize = 14;
                tv.Text = recipe.tasks [i];
                taskView.AddView (tv);
            }
            Button addToMealButton = FindViewById<Button> (Resource.Id.add_rec_to_meal_button);
            addToMealButton.Click += (object sender, EventArgs e) => {
                CachedData.Instance.mostRecentMealAdd = CachedData.Instance.mostRecentRecSel;
                if (CachedData.Instance.PreviousActivity.GetType() == typeof(SearchActivity)) {
                    CachedData.Instance.PreviousActivity.Finish();
                    CachedData.Instance.PreviousActivity.SetResult(Result.Ok);
                    SetResult(Result.Ok, CachedData.Instance.PreviousActivity.Intent);
                    Finish();
                }
            };
        }
开发者ID:cbudo,项目名称:SpeedyChef,代码行数:60,代码来源:RecipeViewActivity.cs

示例9: GetView

        // create a new ImageView for each item referenced by the Adapter
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            //Button tagButton;
            TextView tagButton;

            if (convertView == null)
            {  // if it's not recycled, initialize some attributes
                //tagButton = new Button(context);
                tagButton = new TextView(context);
                //tagButton.LayoutParameters = new GridView.LayoutParams(190, 190);
                tagButton.LayoutParameters = new GridView.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                tagButton.SetTextColor(Color.Rgb(34, 191, 185));
                //tagButton.SetPadding(5, 2, 5, 2);// ltrb
                tagButton.SetPadding(10, 4, 10, 4);// ltrb
                tagButton.SetBackgroundResource(Resource.Drawable.flame_style);

                //imageView.SetScaleType(ImageView.ScaleType.CenterCrop);
            }
            else
            {
                //tagButton = (Button)convertView;
                tagButton = (TextView)convertView;
            }

            // Bitmap bmp = MediaStore.Images.Thumbnails.GetThumbnail(cr, items[position].ImageId, ThumbnailKind.MicroKind, null);
            //imageView.SetImageBitmap(bmp);
            tagButton.Text = items[position].TagStr;
            return tagButton;
        }
开发者ID:yasu0796,项目名称:XamarinCloudVisionApp,代码行数:30,代码来源:TagAdapter.cs

示例10: Calendar_DaySlotLoading

        private void Calendar_DaySlotLoading(object sender, CalendarDaySlotLoadingEventArgs e)
        {
            // get day
            Java.Util.Date date = e.Date;
            Java.Util.Calendar cal = Java.Util.Calendar.GetInstance(Java.Util.Locale.English);
            cal.Time = date;
            int day = cal.Get(Java.Util.CalendarField.DayOfMonth);

            // create day slot layout container
            CalendarDaySlotBase layout = new CalendarDaySlotBase(ApplicationContext);
            layout.SetGravity(GravityFlags.Top);
            layout.SetVerticalGravity(GravityFlags.Top);
            layout.Orientation = Orientation.Vertical;
            layout.SetPadding(5, 5, 5, 5);
            LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            layout.LayoutParameters = linearLayoutParams;

            // create text element
            TextView tv = new TextView(ApplicationContext);
            //LinearLayout.LayoutParams linearLayoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
            //vv.LayoutParameters = linearLayoutParams;
            tv.Gravity = GravityFlags.Top;
            tv.Text = day.ToString();

            if (e.AdjacentDay)
            {
                // format adjacent day text
                tv.SetTextColor(Android.Graphics.Color.DarkGray);
            }

            // add text element to layout
            layout.AddView(tv);


            // add weather image for certain days
            if (day >= 14 && day <= 23)
            {
                ImageView iv = new ImageView(ApplicationContext);
                switch (day % 5)
                {
                    case 0: iv.SetImageResource(Resource.Drawable.Cloudy);
                        break;
                    case 1: iv.SetImageResource(Resource.Drawable.PartlyCloudy);
                        break;
                    case 2: iv.SetImageResource(Resource.Drawable.Rain);
                        break;
                    case 3: iv.SetImageResource(Resource.Drawable.Storm);
                        break;
                    case 4: iv.SetImageResource(Resource.Drawable.Sun);
                        break;

                }
                layout.AddView(iv);
               
            }

            // finally, set layout to day slot
            e.DaySlot = layout;
        }
开发者ID:GoXuni,项目名称:Xamarin.Android-Samples,代码行数:59,代码来源:MainActivity.cs

示例11: Initialize

		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.Center);


			image = new RelativeLayout(context);

			txtTitle = new TextView (context);
			background = new LinearLayout (context);
			linearTitle = new LinearLayout (context);
			linearButton = new LinearLayout (context);
			imgPlay = new ImageButton (context);
			video = new VideoView (context);

			image.SetGravity (GravityFlags.Bottom);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (111));
			background.Orientation = Orientation.Horizontal;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			linearTitle.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (482), Configuration.getHeight (111));
			linearTitle.Orientation = Orientation.Horizontal;
			linearTitle.SetGravity (GravityFlags.Center);

			linearButton.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (100), Configuration.getHeight (111));
			linearButton.Orientation = Orientation.Horizontal;
			linearButton.SetGravity (GravityFlags.Center);


			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			//image.SetGravity (GravityFlags.Bottom);
			video.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(582),Configuration.getHeight(394));


			imgPlay.Alpha = 255.0f;
			imgPlay.SetBackgroundColor (Color.Transparent);

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			txtTitle.SetPadding (Configuration.getWidth (20), 0, 0, 0);
			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			txtTitle.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
			txtTitle.SetMaxLines (2);

			//imgPlay.SetImageBitmap (Bitmap.CreateStxtcaledBitmap (getBitmapFromAsset ("icons/"), Configuration.getWidth (83), Configuration.getHeight (83), true));
			linearTitle.AddView (txtTitle);
			linearButton.AddView (imgPlay);

			background.AddView (linearTitle);
			background.AddView (linearButton);



			image.AddView (background);

			this.AddView (image);
			//this.AddView (background);


		}
开发者ID:aocsa,项目名称:eduticnow.droid,代码行数:59,代码来源:CustomerVideoView.cs

示例12: SetTimeRemaining

		public static void SetTimeRemaining(Post post, TextView timeRemainingTextView, ImageView clockImageView)
		{
			if (post.IsExpired())
			{
				timeRemainingTextView.Text = StringUtils.GetTopTime(post);
				timeRemainingTextView.SetTextColor(Color.White);
				timeRemainingTextView.SetBackgroundResource(Resource.Drawable.RoundedCorners5Black);
				clockImageView.Visibility = ViewStates.Invisible;
			}
			else
			{
				timeRemainingTextView.Text = StringUtils.GetPrettyDateAbs(post.expiration);
				timeRemainingTextView.SetTextColor(ViewUtils.GetTimeRemainingColor(post.expiration));
				//timeRemainingTextView.SetBackgroundColor(Android.Graphics.Color.Transparent);
				clockImageView.Visibility = ViewStates.Visible;
			}
		}
开发者ID:natevarghese,项目名称:XamarinTen,代码行数:17,代码来源:ViewUtils.cs

示例13: InitTextView

		private void InitTextView( ) {
			tvTabmyAlarm = View.FindViewById<Button>(Resource.Id.tv_tab_myAlarm);
			tvTabotherAlarm = View.FindViewById<Button>(Resource.Id.tv_tab_otherAlarm);
			tvTabmyAlarm.SetTextColor(Resources.GetColor(Resource.Color.blue));

			tvTabmyAlarm.SetOnClickListener(this);
			tvTabotherAlarm.SetOnClickListener(this);
		}
开发者ID:lq-ever,项目名称:EldYoungAndroidApp,代码行数:8,代码来源:AlarmInfoFragment.cs

示例14: StyleUILabel

        public static void StyleUILabel( TextView label, string font, uint size )
        {
            label.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
            label.SetBackgroundColor( Android.Graphics.Color.Transparent );

            label.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( font ), TypefaceStyle.Normal );
            label.SetTextSize( Android.Util.ComplexUnitType.Dip, size );
        }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:8,代码来源:ControlStyling.cs

示例15: RenderPrice

        private View RenderPrice(Car car)
        {
            var textView = new TextView(Context);
            textView.Text = (car.Price / 1000).ToString("R #,##0K");
            textView.SetPadding(20, 10, 20, 10);
            textView.TextSize = TextSize;

            if (car.Price < 500000)
            {
                textView.SetTextColor(Color.DarkGreen);
            }
            else if (car.Price > 1000000)
            {
                textView.SetTextColor(Color.DarkRed);
            }

            return textView;
        }
开发者ID:cyecp,项目名称:XamarinComponents,代码行数:18,代码来源:CarTableDataAdapter.cs


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