Example usage for android.widget TextView setTextColor

List of usage examples for android.widget TextView setTextColor

Introduction

In this page you can find the example usage for android.widget TextView setTextColor.

Prototype

@android.view.RemotableViewMethod
public void setTextColor(ColorStateList colors) 

Source Link

Document

Sets the text color.

Usage

From source file:Main.java

/**
 * Will parse a color and set it as text color
 * @param color a string that can be converted into a hex color e.g #000fff
 * @param v textview// w  w w.ja  v a  2s  .  c om
 */
public static void setTextColor(String color, TextView v) {
    v.setTextColor(Color.parseColor(color.isEmpty() ? "#000000" : color));
}

From source file:Main.java

public static void setTextColor(int color, TextView... views) {
    for (TextView view : views) {
        view.setTextColor(view.getResources().getColor(color));
    }/*from  w w w  . j a va 2  s . co m*/
}

From source file:Main.java

/**
 * Sets the text color for a {@link TextView}.
 *
 * @param textview   text view instance//from   w w w .ja  v  a  2  s .c  o m
 * @param argb  text RGB color with alpha
 */
public static void setTextColor(TextView textview, int argb) {
    textview.setTextColor(argb);
    textview.invalidate();
}

From source file:Main.java

public static void setTextColors(TextView textview, ColorStateList colorStateList) {
    textview.setTextColor(colorStateList);
}

From source file:Main.java

public static void customActionBarSearchViewTextColor(SearchView searchView) {
    int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
    TextView textView = (TextView) searchView.findViewById(id);
    textView.setTextColor(Color.WHITE);
}

From source file:Main.java

public static void setTextViewColor(TextView textview, int i) {
    if (isValidInAppMessageColor(i)) {
        textview.setTextColor(i);
    }//w  w  w.  j av a  2s.c  o m
}

From source file:Main.java

public static void showDialog(TextView dialogView, String message, int color) {
    dialogView.setText(message);/* w  w  w  .j  a  v a 2s .  c  om*/
    dialogView.setTextColor(color);
}

From source file:cn.foxnickel.listentome.view.ViewUtil.java

public static View getWordsView(Context context, String word, @ColorRes int color, boolean isTextSelectable) {
    TextView tv = new TextView(context);
    tv.setTextColor(ContextCompat.getColor(context, color));
    tv.setPadding(0, 6, 0, 6);/*from  ww  w. j  ava2s.  co  m*/
    tv.setTextSize(16);
    tv.setTextIsSelectable(isTextSelectable);
    tv.setGravity(Gravity.LEFT);
    tv.setText(word);
    return tv;
}

From source file:Main.java

public static void updateInfoPanel(TextView infoPanel, int color, String message) {
    if (infoPanel != null) {
        infoPanel.setTextColor(color);
        infoPanel.setText(message);/*  w  w w  . ja  v a  2s.  c o  m*/
        infoPanel.setSelected(true);
        infoPanel.invalidate();
    }
}

From source file:Main.java

/**
 * This method formats a TextView as if it was a hyperlink. This method
 * is useful when it's not a real HTML link but there's an OnClickListener
 * assigned to the TextView, taking you to some other action.
 *
 * @param t The TextView whose appearance is to be changed.
 *//*from  ww w.  j  a va  2  s .com*/
public static TextView renderAsLink(TextView t) {
    t.setPaintFlags(t.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    t.setTextColor(Color.BLUE);
    return t;
}