Xamarin.Android 开发SetTextColor颜色设置

在网上看了些SetTextColor设置方法,试过基本没用,最后看源码发现有迹可循,特来分享!

    FindViewById<TextView>(Resource.Id.text_homepage).SetTextColor(ColorStateList.ValueOf(Color.Red));

这样写ColorStateList要引用包,还有个弊端库里面颜色值比较少Color.Red:

  FindViewById<TextView>(Resource.Id.text_homepage).SetTextColor(ColorStateList.ValueOf(Color.Argb(255,203,41,32)));

根据提供的类库发现这样设置Argb可以达到自定义控件的颜色值

猜你喜欢

转载自blog.csdn.net/qq_30423365/article/details/72467273
今日推荐