Android 动态修改TextView 颜色Color

来源:互联网 发布:老版本知乎2.4.4 编辑:程序博客网 时间:2024/05/23 23:56
 t3=(TextView) findViewById(R.id.t3);        t3.setText(Html.fromHtml("<font color=#00ff00>"  +"asdf" + "</font>"));                        t4=(TextView) findViewById(R.id.t4);        t4.setTextColor(getResources().getColor(R.color.color_4181ca));

 <TextView        android:id="@+id/t1"        android:layout_width="match_parent"        android:layout_height="40dp"        android:textColor="#ff0000"        android:text="@string/hello_world" />    <TextView        android:id="@+id/t2"        android:layout_width="match_parent"        android:layout_height="@color/color_055555"        android:text="@string/hello_world" />

0 0
原创粉丝点击