android.widget.TextView.getTextColors()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(234)

本文整理了Java中android.widget.TextView.getTextColors()方法的一些代码示例,展示了TextView.getTextColors()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.getTextColors()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:getTextColors

TextView.getTextColors介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

if (COLOR_SEARCH_RECURSE_TIP.equals(szText))
  notification_text_color = text.getTextColors().getDefaultColor();
  notification_text_size = text.getTextSize();
  DisplayMetrics metrics = new DisplayMetrics();

代码示例来源:origin: stackoverflow.com

private TextView myTextView;
private int defaultTextColor;

public void onCreate(Bundle savedInstanceState) {
  myTextView = (TextView) findViewById(R.id.myTextView);
  defaultTextColor = myTextView.getTextColors().getDefaultColor();
}

public void changeColorBack() {
  myTextView.setTextColor(defaultTextColor);
}

代码示例来源:origin: florent37/FiftyShadesOf

@Override
public void beforeStart() {
  super.beforeStart();
  this.textColor = view.getTextColors();
  this.darker = view.getTypeface() != null && view.getTypeface().isBold();
}

代码示例来源:origin: bufferapp/BufferTextInputLayout

void updateLabelState(boolean animate) {
  final boolean isEnabled = isEnabled();
  final boolean hasText = editText != null && !TextUtils.isEmpty(editText.getText());
  final boolean isFocused = arrayContains(getDrawableState(), android.R.attr.state_focused);
  final boolean isErrorShowing = !TextUtils.isEmpty(getError());
  if (defaultTextColor != null) {
    collapsingTextHelper.setExpandedTextColor(defaultTextColor);
  }
  if (isEnabled && counterOverflowed && counterView != null) {
    collapsingTextHelper.setCollapsedTextColor(counterView.getTextColors());
  } else if (isEnabled && isFocused && focusedTextColor != null) {
    collapsingTextHelper.setCollapsedTextColor(focusedTextColor);
  } else if (defaultTextColor != null) {
    collapsingTextHelper.setCollapsedTextColor(defaultTextColor);
  }
  if (hasText || (isEnabled() && (isFocused || isErrorShowing))) {
    // We should be showing the label so do so if it isn't already
    collapseHint(animate);
  } else {
    // We should not be showing the label so hide it
    expandHint(animate);
  }
}

代码示例来源:origin: daniel-stoneuk/material-about-library

holder.title.setTextColor(titleColor);
} else {
  holder.title.setTextColor(holder.title.getTextColors().getDefaultColor());

代码示例来源:origin: bufferapp/BufferTextInputLayout

TextViewCompat.setTextAppearance(errorView, errorTextAppearance);
if (Build.VERSION.SDK_INT >= 23
    && errorView.getTextColors().getDefaultColor() == Color.MAGENTA) {

代码示例来源:origin: nex3z/ToggleButtonGroup

public ColorStateList getTextColors() {
  return mTvText.getTextColors();
}

代码示例来源:origin: stackoverflow.com

TextView tv = (TextView) findViewById(R.id.yourComponentId);
int tv_color = tv.getTextColors().getDefaultColor();

代码示例来源:origin: stackoverflow.com

TextView dummy = new TextView(getActivity());
myTextView.setTextColor(dummy.getTextColors());

代码示例来源:origin: stackoverflow.com

final TextView message = new TextView(TheApp.this);  
final SpannableString s = new SpannableString("Some text with example.com in it.");
message.setText(s);  
...
message.setTextColor(message.getTextColors().getDefaultColor());
...
Linkify.addLinks(message, Linkify.WEB_URLS);

代码示例来源:origin: mtotschnig/MyExpenses

public ColorStateList getHeaderColor() {
  final TextView titleView = getHeaderTextView();
  return titleView != null ? titleView.getTextColors() : null;
}

代码示例来源:origin: stackoverflow.com

View view = ListAdapter.getView(0, null, null);
 TextView textView = (TextView) view.findViewById(R.id.myitemRow);
 ColorStateList mlist = textView.getTextColors();
 int color = mlist.getDefaultColor();

代码示例来源:origin: stackoverflow.com

TextView tv = (TextView) findViewById(R.id.yourComponentId);
ColorStateList colorStateList = tv.getTextColors();
int tv_color colorStateList.getColorForState(states, failColor);

代码示例来源:origin: stackoverflow.com

protected void about() {

    View messageView = getLayoutInflater().inflate(R.layout.about, null, false);

  TextView textView = (TextView) messageView.findViewById(R.id.about_credits);
  int defaultColor = textView.getTextColors().getDefaultColor();
  textView.setTextColor(defaultColor);

  AlertDialog.Builder builder = new AlertDialog.Builder(this);
  builder.setIcon(R.drawable.app_icon);
  builder.setTitle(R.string.app_name);
  builder.setView(messageView);
  builder.create();
  builder.show();
}

代码示例来源:origin: com.albedinsky.android.support/support-dialogs

/**
 */
@NonNull
@Override
protected View onCreateView(@NonNull ViewGroup parent, int position) {
  final TextView textView = (TextView) mLayoutInflater.inflate(R.layout.dialog_item_list_date_year, parent, false);
  this.textSize = textView.getTextSize();
  this.useDefaultTextColors = textView.getTextColors().getDefaultColor() == Color.TRANSPARENT;
  if (useDefaultTextColors && textColor != null) {
    textView.setTextColor(textColor);
  }
  return textView;
}

代码示例来源:origin: com.albedinsky.android/dialogs

/**
 */
@NonNull
@Override
protected View onCreateView(@NonNull ViewGroup parent, int position) {
  final TextView textView = (TextView) mLayoutInflater.inflate(R.layout.dialog_item_list_date_year, parent, false);
  this.textSize = textView.getTextSize();
  this.useDefaultTextColors = textView.getTextColors().getDefaultColor() == Color.TRANSPARENT;
  if (useDefaultTextColors && textColor != null) {
    textView.setTextColor(textColor);
  }
  return textView;
}

代码示例来源:origin: HpWens/MeiWidgetView

/**
 * 设置文本颜色
 */
private void setTextSelector() {
  mTextView = (TextView) mView;
  mTextColor = (mTextColor == Integer.MAX_VALUE ? mTextView.getTextColors().getDefaultColor() : mTextColor);
  if (mTextColor != Integer.MAX_VALUE
      || mTextPressedColor != Integer.MAX_VALUE
      || mTextDisabledColor != Integer.MAX_VALUE
      || mTextSelectedColor != Integer.MAX_VALUE
      || mTextCheckedColor != Integer.MAX_VALUE) {
    ColorStateList colorStateList =
        getColorSelector(mTextColor, mTextPressedColor, mTextDisabledColor, mTextSelectedColor, mTextCheckedColor);
    mTextView.setTextColor(colorStateList);
  }
}

代码示例来源:origin: adolfAn/FBReader_AS

private void setupAnnotation(Book book, PluginCollection pluginCollection) {
  final TextView titleView = (TextView)findViewById(R.id.book_info_annotation_title);
  final TextView bodyView = (TextView)findViewById(R.id.book_info_annotation_body);
  final String annotation = BookUtil.getAnnotation(book, pluginCollection);
  if (annotation == null) {
    titleView.setVisibility(View.GONE);
    bodyView.setVisibility(View.GONE);
  } else {
    titleView.setText(myResource.getResource("annotation").getValue());
    bodyView.setText(HtmlUtil.getHtmlText(NetworkLibrary.Instance(Paths.systemInfo(this)), annotation));
    bodyView.setMovementMethod(new LinkMovementMethod());
    bodyView.setTextColor(ColorStateList.valueOf(bodyView.getTextColors().getDefaultColor()));
  }
}

代码示例来源:origin: adolfAn/FBReader_AS

private final void setupDescription() {
  setTextFromResource(R.id.network_book_description_title, "description");
  CharSequence description = myBook.getSummary();
  if (description == null) {
    description = myResource.getResource("noDescription").getValue();
  }
  final TextView descriptionView = (TextView)findViewById(R.id.network_book_description);
  descriptionView.setText(description);
  descriptionView.setMovementMethod(new LinkMovementMethod());
  descriptionView.setTextColor(
    ColorStateList.valueOf(descriptionView.getTextColors().getDefaultColor())
  );
}

代码示例来源:origin: samlss/Broccoli

private void recordTextViewOriginalState(TextView textView, PlaceholderParameter parameter){
  if (textView == null
      || parameter == null)
    return;
  PlaceholderPreStateSaver  placeholderPreStateSaver = getOrNewPreStateSaver(parameter);
  Drawable[] drawables = textView.getCompoundDrawables();
  placeholderPreStateSaver.setRestoredTextLeftDrawable(drawables[0]);
  placeholderPreStateSaver.setRestoredTextTopDrawable(drawables[1]);
  placeholderPreStateSaver.setRestoredTextRightDrawable(drawables[2]);
  placeholderPreStateSaver.setRestoredTextBottomDrawable(drawables[3]);
  placeholderPreStateSaver.setRestoredTextColor(textView.getTextColors());
  placeholderPreStateSaver.setRestoredBackgroundDrawable(textView.getBackground());
  textView.setCompoundDrawables(null, null, null, null);
  textView.setTextColor(Color.TRANSPARENT);
}

相关文章

微信公众号

最新文章

更多

TextView类方法