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

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

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

TextView.getCurrentTextColor介绍

暂无

代码示例

代码示例来源:origin: roughike/BottomBar

int getCurrentDisplayedTitleColor() {
  if (titleView != null) {
    return titleView.getCurrentTextColor();
  }
  return 0;
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

private void captureValues(TransitionValues transitionValues) {
  transitionValues.values.put(PROPNAME_BACKGROUND, transitionValues.view.getBackground());
  if (transitionValues.view instanceof TextView) {
    transitionValues.values.put(PROPNAME_TEXT_COLOR,
        ((TextView) transitionValues.view).getCurrentTextColor());
  }
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

private void captureValues(TransitionValues transitionValues) {
  transitionValues.values.put(PROPNAME_BACKGROUND, transitionValues.view.getBackground());
  if (transitionValues.view instanceof TextView) {
    transitionValues.values.put(PROPNAME_TEXT_COLOR,
        ((TextView) transitionValues.view).getCurrentTextColor());
  }
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

@Override
public void onTransitionPause(@NonNull Transition transition) {
  if (mChangeBehavior != CHANGE_BEHAVIOR_IN) {
    view.setText(endText);
    if (view instanceof EditText) {
      setSelection(((EditText) view), endSelectionStart, endSelectionEnd);
    }
  }
  if (mChangeBehavior > CHANGE_BEHAVIOR_KEEP) {
    mPausedColor = view.getCurrentTextColor();
    view.setTextColor(endColor);
  }
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

@Override
public void onTransitionPause(@NonNull Transition transition) {
  if (mChangeBehavior != CHANGE_BEHAVIOR_IN) {
    view.setText(endText);
    if (view instanceof EditText) {
      setSelection(((EditText) view), endSelectionStart, endSelectionEnd);
    }
  }
  if (mChangeBehavior > CHANGE_BEHAVIOR_KEEP) {
    mPausedColor = view.getCurrentTextColor();
    view.setTextColor(endColor);
  }
}

代码示例来源:origin: google/ExoPlayer

@Override
public void onBindViewHolder(QueueItemViewHolder holder, int position) {
 TextView view = holder.textView;
 view.setText(playerManager.getItem(position).name);
 // TODO: Solve coloring using the theme's ColorStateList.
 view.setTextColor(ColorUtils.setAlphaComponent(view.getCurrentTextColor(),
    position == playerManager.getCurrentItemIndex() ? 255 : 100));
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

private void captureValues(TransitionValues transitionValues) {
  if (transitionValues.view instanceof TextView) {
    TextView textview = (TextView) transitionValues.view;
    transitionValues.values.put(PROPNAME_TEXT, textview.getText());
    if (textview instanceof EditText) {
      transitionValues.values.put(PROPNAME_TEXT_SELECTION_START,
          textview.getSelectionStart());
      transitionValues.values.put(PROPNAME_TEXT_SELECTION_END,
          textview.getSelectionEnd());
    }
    if (mChangeBehavior > CHANGE_BEHAVIOR_KEEP) {
      transitionValues.values.put(PROPNAME_TEXT_COLOR, textview.getCurrentTextColor());
    }
  }
}

代码示例来源:origin: square/assertj-android

public S hasCurrentTextColor(int color) {
 isNotNull();
 int actualColor = actual.getCurrentTextColor();
 assertThat(actualColor) //
   .overridingErrorMessage("Expected current text color <%s> but was <%s>.",
     Integer.toHexString(color), Integer.toHexString(actualColor)) //
   .isEqualTo(color);
 return myself;
}

代码示例来源:origin: andkulikov/Transitions-Everywhere

private void captureValues(TransitionValues transitionValues) {
  if (transitionValues.view instanceof TextView) {
    TextView textview = (TextView) transitionValues.view;
    transitionValues.values.put(PROPNAME_TEXT, textview.getText());
    if (textview instanceof EditText) {
      transitionValues.values.put(PROPNAME_TEXT_SELECTION_START,
          textview.getSelectionStart());
      transitionValues.values.put(PROPNAME_TEXT_SELECTION_END,
          textview.getSelectionEnd());
    }
    if (mChangeBehavior > CHANGE_BEHAVIOR_KEEP) {
      transitionValues.values.put(PROPNAME_TEXT_COLOR, textview.getCurrentTextColor());
    }
  }
}

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

@Override
  public Animator getAnimator(View viewToMove) {
    if (viewToMove instanceof TextView) {
      final ObjectAnimator objectAnimator = ObjectAnimator.ofInt(viewToMove, "textColor", ((TextView) viewToMove).getCurrentTextColor(), textColor);
      objectAnimator.setEvaluator(new ArgbEvaluator());
      return objectAnimator;
    } else {
      return null;
    }
  }
}

代码示例来源:origin: robolectric/robolectric

@Test
public void shouldSetTextAndTextColorWhileInflatingXmlLayout() throws Exception {
 Activity activity = activityController.get();
 activity.setContentView(R.layout.text_views);
 TextView black = (TextView) activity.findViewById(R.id.black_text_view);
 assertThat(black.getText().toString()).isEqualTo("Black Text");
 assertThat(black.getCurrentTextColor()).isEqualTo(0xff000000);
 TextView white = (TextView) activity.findViewById(R.id.white_text_view);
 assertThat(white.getText().toString()).isEqualTo("White Text");
 assertThat(white.getCurrentTextColor()).isEqualTo(activity.getResources().getColor(android.R.color.white));
 TextView grey = (TextView) activity.findViewById(R.id.grey_text_view);
 assertThat(grey.getText().toString()).isEqualTo("Grey Text");
 assertThat(grey.getCurrentTextColor()).isEqualTo(activity.getResources().getColor(R.color.grey42));
}

代码示例来源:origin: eleme/UETool

@Override
  public List<Item> getAttrs(Element element) {
    List<Item> items = new ArrayList<>();
    TextView textView = ((TextView) element.getView());
    items.add(new TitleItem("TextView"));
    items.add(new EditTextItem("Text", element, EditTextItem.Type.TYPE_TEXT, textView.getText().toString()));
    items.add(new AddMinusEditItem("TextSize(sp)", element, EditTextItem.Type.TYPE_TEXT_SIZE, px2sp(textView.getTextSize())));
    items.add(new EditTextItem("TextColor", element, EditTextItem.Type.TYPE_TEXT_COLOR, Util.intToHexColor(textView.getCurrentTextColor())));
    List<Pair<String, Bitmap>> pairs = Util.getTextViewBitmap(textView);
    for (Pair<String, Bitmap> pair : pairs) {
      items.add(new BitmapItem(pair.first, pair.second));
    }
    items.add(new SwitchItem("IsBold", element, SwitchItem.Type.TYPE_IS_BOLD, textView.getTypeface() != null ? textView.getTypeface().isBold() : false));
    return items;
  }
}

代码示例来源:origin: EverythingMe/overscroll-decor

private final int mDragColorRight = getResources().getColor(android.R.color.holo_red_light);
private final int mBounceBackColorRight = getResources().getColor(android.R.color.holo_orange_dark);
private final int mClearColor = mHorizScrollMeasure.getCurrentTextColor();

代码示例来源:origin: fython/MaterialStepperView

int lastTitleTextColor = mTitleText.getCurrentTextColor();
if (mTitleColorAnimator != null) mTitleColorAnimator.cancel();
mTitleText.setTextAppearance(getContext(), state == STATE_DONE ?
  if (mSummaryColorAnimator != null) mSummaryColorAnimator.cancel();
  mSummaryColorAnimator = ViewUtils.createArgbAnimator(
      mSummaryText, "textColor", mSummaryText.getCurrentTextColor(), mErrorColor);
  mSummaryColorAnimator.setDuration(mAnimationDuration);
  mSummaryColorAnimator.start();
  if (mSummaryColorAnimator != null) mSummaryColorAnimator.cancel();
  mSummaryColorAnimator = ViewUtils.createArgbAnimator(
      mSummaryText, "textColor", mSummaryText.getCurrentTextColor(), mLineColor);
  mSummaryColorAnimator.setDuration(mAnimationDuration);
  mSummaryColorAnimator.start();

代码示例来源:origin: eleme/UETool

TextView textView = ((TextView) (item.getElement().getView()));
int color = Color.parseColor(vDetail.getText().toString());
if (color != textView.getCurrentTextColor()) {
  vColor.setBackgroundColor(color);
  textView.setTextColor(color);

代码示例来源:origin: EverythingMe/overscroll-decor

private final int mDragColorBottom = getResources().getColor(android.R.color.holo_purple);
private final int mBounceBackColorBottom = getResources().getColor(android.R.color.holo_blue_light);
private final int mClearColor = mHorizScrollMeasure.getCurrentTextColor();

代码示例来源:origin: jrvansuita/MaterialAbout

private int getNameColor() {
  return tvName.getCurrentTextColor();
}

代码示例来源:origin: k9mail/k-9

mFlagged = findViewById(R.id.flagged);
defaultSubjectColor = mSubjectView.getCurrentTextColor();
mFontSizes.setViewTextSize(mSubjectView, mFontSizes.getMessageViewSubject());
mFontSizes.setViewTextSize(mDateView, mFontSizes.getMessageViewDate());

代码示例来源:origin: burhanrashid52/PhotoEditor

@Override
  public void onLongClick() {
    String textInput = textInputTv.getText().toString();
    int currentTextColor = textInputTv.getCurrentTextColor();
    if (mOnPhotoEditorListener != null) {
      mOnPhotoEditorListener.onEditTextChangeListener(textRootView, textInput, currentTextColor);
    }
  }
});

代码示例来源:origin: GcsSloop/diycode

@Override
  public Animator getAnimator(View viewToMove) {
    if (viewToMove instanceof TextView) {
      final ObjectAnimator objectAnimator = ObjectAnimator.ofInt(viewToMove, "textColor", ((TextView) viewToMove).getCurrentTextColor(), textColor);
      objectAnimator.setEvaluator(new ArgbEvaluator());
      return objectAnimator;
    } else {
      return null;
    }
  }
}

相关文章

微信公众号

最新文章

更多

TextView类方法