Sunday, September 6, 2015

Android studio textview in xml set textcole="@color/red" doesn't work?

<TextView    android:id="@+id/tv_custom_title"    android:layout_marginTop="20dp"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:clickable="true"    android:gravity="center"    android:textColor="@color/chow_red"/>


Today i meet the question! I din't know very much.

In this way i can't set TextView change color to my want!

So i just use dnymic to set TextView text color!

Folling this way:  Ok


mTvCustomTitle = (TextView) view.findViewById(R.id.tv_custom_title);mTvCustomTitle.setTextColor(getResources().getColor(R.color.chow_red));




No comments:

Post a Comment