本文整理匯總了Java中android.widget.TextView.setHintTextColor方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setHintTextColor方法的具體用法?Java TextView.setHintTextColor怎麽用?Java TextView.setHintTextColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setHintTextColor方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: apply
import android.widget.TextView; //導入方法依賴的package包/類
@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);
}
}
}
示例2: process
import android.widget.TextView; //導入方法依賴的package包/類
@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);
}
}
示例3: applyStyle_TextView
import android.widget.TextView; //導入方法依賴的package包/類
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();
}
示例4: onFinishInflate
import android.widget.TextView; //導入方法依賴的package包/類
@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();
}