Android examples for User Interface:TextView Color
set Text Color for TextView
//package com.java2s; import android.app.Activity; import android.support.annotation.ColorRes; import android.support.annotation.IdRes; import android.view.View; import android.widget.TextView; public class Main { public static void setTextColor(@ColorRes int colorRes, Activity activity, @IdRes int viewId) { TextView view = findView(activity, viewId); view.setTextColor(activity.getResources().getColor(colorRes)); }//from ww w . j a va 2 s.c om public static <T extends View> T findView(View parent, @IdRes int viewId) { return (T) parent.findViewById(viewId); } public static <T extends View> T findView(Activity activity, @IdRes int viewId) { return (T) activity.findViewById(viewId); } }