Java Code Examples for android.widget.TextView.setHintTextColor()

The following are Jave code examples for showing how to use setHintTextColor() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Android-Skin   File: TextHintColorAttr.java   View Source Code Vote up 6 votes
@Override
public void apply(View view) {
    if (view == null) {
        return;
    }
    if (view instanceof TextView) {
        TextView tv = (TextView) view;
        if ((RES_TYPE_NAME_COLOR.equals(attrValueTypeName)) || (RES_TYPE_NAME_HINT_COLOR.equals(attrValueTypeName))) {
            ColorStateList color =
                AndroidSkin.getInstance()
                    .getSkinColorStateList(attrValueTypeName, attrValueRefName, attrValueRefId);
            tv.setHintTextColor(color);

        }
    }
}
 
Example 2
Project: MusicX-music-player   File: TextColorTagProcessor.java   View Source Code Vote up 6 votes
@Override
public void process(@NonNull Context context, @Nullable String key, @NonNull View view, @NonNull String suffix) {
    final TextView tv = (TextView) view;
    final ColorResult result = getColorFromSuffix(context, key, view, suffix);
    if (result == null) return;

    if (mHintMode)
        result.adjustAlpha(0.5f);

    final ColorStateList sl = getTextSelector(result.getColor(), view, false);
    if (mLinkMode) {
        tv.setLinkTextColor(sl);
    } else if (mHintMode) {
        tv.setHintTextColor(sl);
        // Sets parent TextInputLayout hint color
        if (view.getParent() != null && view.getParent() instanceof TextInputLayout) {
            final TextInputLayout til = (TextInputLayout) view.getParent();
            TextInputLayoutUtil.setHint(til, result.getColor());
        }
    } else {
        tv.setTextColor(sl);
    }
}
 
Example 3
Project: PNightMode   File: ThemeUtils.java   View Source Code Vote up 5 votes
public static void applyStyle_TextView(TextView v, int styleId) {
    TypedArray a = v.getContext().getTheme().obtainStyledAttributes(styleId,
            STYLEABLE_ARRAY_TextView);
    int N = a.getIndexCount();
    for (int i = 0; i < N; i++) {
        int attr = a.getIndex(i);
        if (attr == STYLEABLE_TextView_textSize) {
            int textSize = a.getDimensionPixelSize(attr, 0);
            if (textSize != 0) {
                v.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
            }
        } else if (attr == STYLEABLE_TextView_textColor) {
            ColorStateList textColor = a.getColorStateList(attr);
            v.setTextColor(textColor);
        } else if (attr == STYLEABLE_TextView_textColorHint) {
            ColorStateList textColorHint = a.getColorStateList(attr);
            v.setHintTextColor(textColorHint);
        } else if (attr == STYLEABLE_TextView_privateImeOptions) {
            String imeOpt = a.getString(attr);
            v.setPrivateImeOptions(imeOpt);
        } else if(attr == STYLEABLE_TextView_textCursorDrawable){
            int  mCursorDrawableRes = a.getResourceId(attr, 0);
            if(mCursorDrawableRes != 0){
                setCursorDrawable(v,mCursorDrawableRes);
            }
        }
    }
    a.recycle();
}
 
Example 4
Project: okwallet   File: CurrencyAmountView.java   View Source Code Vote up 5 votes
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    final Context context = getContext();

    textView = (TextView) getChildAt(0);
    textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    textView.setHintTextColor(lessSignificantColor);
    textView.setHorizontalFadingEdgeEnabled(true);
    textView.setSingleLine();
    setValidateAmount(textView instanceof EditText);
    textView.addTextChangedListener(textViewListener);
    textView.setOnFocusChangeListener(textViewListener);

    contextButton = new View(context) {
        @Override
        protected void onMeasure(final int wMeasureSpec, final int hMeasureSpec) {
            setMeasuredDimension(textView.getCompoundPaddingRight(), textView.getMeasuredHeight());
        }
    };
    final LayoutParams chooseViewParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    chooseViewParams.gravity = Gravity.RIGHT;
    contextButton.setLayoutParams(chooseViewParams);
    this.addView(contextButton);

    updateAppearance();
}