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

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

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

TextView.getHint介绍

暂无

代码示例

代码示例来源:origin: facebook/facebook-android-sdk

public static String getHintOfView(View view) {
  CharSequence hintObj = null;
  if (view instanceof EditText) {
    hintObj = ((EditText) view).getHint();
  } else if (view instanceof TextView) {
    hintObj = ((TextView) view).getHint();
  }
  return hintObj == null ? "" : hintObj.toString();
}

代码示例来源:origin: jbruchanov/AnUitor

data.put("Hint", String.valueOf(tv.getHint()));
data.put("HintTextColors:", String.valueOf(tv.getHintTextColors()));
data.put("ImeActionId", tv.getImeActionId());

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

public S hasHint(CharSequence hint) {
 isNotNull();
 CharSequence actualHint = actual.getHint();
 assertThat(actualHint) //
   .overridingErrorMessage("Expected hint <%s> but was <%s>.", hint, actualHint) //
   .isEqualTo(hint);
 return myself;
}

代码示例来源:origin: RobotiumTech/robotium

if (view.getText().toString().equals("") && view.getHint() != null){
  matcher = pattern.matcher(view.getHint().toString());
  if (matcher.find()){
    uniqueTextViews.add(view);

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

@Test
public void shouldSetHintAndHintColorWhileInflatingXmlLayout() throws Exception {
 Activity activity = activityController.get();
 activity.setContentView(R.layout.text_views_hints);
 TextView black = (TextView) activity.findViewById(R.id.black_text_view_hint);
 assertThat(black.getHint().toString()).isEqualTo("Black Hint");
 assertThat(black.getCurrentHintTextColor()).isEqualTo(0xff000000);
 TextView white = (TextView) activity.findViewById(R.id.white_text_view_hint);
 assertThat(white.getHint().toString()).isEqualTo("White Hint");
 assertThat(white.getCurrentHintTextColor()).isEqualTo(activity.getResources().getColor(android.R.color.white));
 TextView grey = (TextView) activity.findViewById(R.id.grey_text_view_hint);
 assertThat(grey.getHint().toString()).isEqualTo("Grey Hint");
 assertThat(grey.getCurrentHintTextColor()).isEqualTo(activity.getResources().getColor(R.color.grey42));
}

代码示例来源:origin: willowtreeapps/Hyperion-Android

attributes.add(new MutableStringViewAttribute("Hint", view.getHint()) {
  @Override
  protected void mutate(CharSequence value) {

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

TextView tvDay = (TextView) findViewById(R.id.day_textview);
tvDay.setEms(tvDay.getHint().length());

代码示例来源:origin: com.squareup.assertj/assertj-android

public S hasHint(CharSequence hint) {
 isNotNull();
 CharSequence actualHint = actual.getHint();
 assertThat(actualHint) //
   .overridingErrorMessage("Expected hint <%s> but was <%s>.", hint, actualHint) //
   .isEqualTo(hint);
 return myself;
}

代码示例来源:origin: com.jayway.android.robotium/robotium-solo

if (view.getText().toString().equals("") && view.getHint() != null){
  matcher = pattern.matcher(view.getHint().toString());
  if (matcher.find()){
    uniqueTextViews.add(view);

代码示例来源:origin: luili16/UIMocker

if (textStr.equals("") && view.getHint() != null){
  matcher = pattern.matcher(view.getHint().toString());
  if (matcher.find()){
    return true;

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

return expectedHint.equals(editText.getHint());
} else {
 return false;

代码示例来源:origin: com.google.android.apps.common.testing.accessibility.framework/accessibility-test-framework

if (!TextUtils.isEmpty(((TextView) view).getText())) {
 returnStringBuilder.append(((TextView) view).getText());
} else if (!TextUtils.isEmpty(((TextView) view).getHint())) {
 returnStringBuilder.append(((TextView) view).getHint());

代码示例来源:origin: appium/appium-espresso-driver

@Nullable
public ViewText getText() {
  if (view instanceof ProgressBar) {
    return new ViewText(((ProgressBar) view).getProgress());
  }
  if (view instanceof NumberPicker) {
    return new ViewText(((NumberPicker) view).getValue());
  }
  if (view instanceof TextView) {
    CharSequence textValue = ((TextView) view).getText();
    CharSequence hintValue = ((TextView) view).getHint();
    if ((textValue == null || textValue.toString().isEmpty())
        && hintValue != null && !hintValue.toString().isEmpty()) {
      return new ViewText(hintValue.toString(), true);
    }
    return new ViewText(textValue == null ? null : textValue.toString(), false);
  }
  return null;
}

代码示例来源:origin: hamidness/restring

@Test
public void shouldTransformTextView() {
  Context context = getContext();
  View view = transformer.transform(new TextView(context), getAttributeSet(false));
  assertTrue(view instanceof TextView);
  assertEquals(((TextView) view).getText(), TEXT_ATTR_VALUE);
  assertEquals(((TextView) view).getHint(), HINT_ATTR_VALUE);
  view = transformer.transform(new TextView(context), getAttributeSet(true));
  assertTrue(view instanceof TextView);
  assertEquals(((TextView) view).getText(), TEXT_ATTR_VALUE);
  assertEquals(((TextView) view).getHint(), HINT_ATTR_VALUE);
}

代码示例来源:origin: hamidness/restring

if (view instanceof TextView) {
  assertThat("TextView[text]", ((TextView) view).getText().toString(), startsWith(getLanguage()));
  assertThat("TextView[hint]", ((TextView) view).getHint().toString(), startsWith(getLanguage()));
} else if (view instanceof Toolbar) {
  assertThat("Toolbar[title]", ((Toolbar) view).getTitle().toString(), startsWith(getLanguage()));

相关文章

TextView类方法