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

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

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

TextInputLayout.getHint介绍

暂无

代码示例

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

@NonNull
  @Override
  public List<ViewAttribute> collect(TextInputLayout view, AttributeTranslator attributeTranslator) {
    List<ViewAttribute> attributes = new ArrayList<>();
    attributes.add(new ViewAttribute<>("PasswordToggleDrawable",
        view.getPasswordVisibilityToggleDrawable()));
    attributes.add(new ViewAttribute<>("PasswordToggleContentDisc",
        nonNull(view.getPasswordVisibilityToggleContentDescription())));
    attributes.add(new ViewAttribute<>("CounterMaxLength", view.getCounterMaxLength()));
    attributes.add(new ViewAttribute<>("Hint", nonNull(view.getHint())));
    attributes.add(new ViewAttribute<>("CounterEnabled", view.isCounterEnabled()));
    attributes.add(new ViewAttribute<>("ErrorEnabled", view.isErrorEnabled()));
    attributes.add(new ViewAttribute<>("HintAnimationEnabled", view.isHintAnimationEnabled()));
    attributes.add(new ViewAttribute<>("HintEnabled", view.isHintEnabled()));
    attributes.add(new ViewAttribute<>("PasswordToggleEnabled",
        view.isPasswordVisibilityToggleEnabled()));
    return attributes;
  }
}

代码示例来源:origin: playerone-id/EosCommander

@Override
  public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    final InputConnection ic = super.onCreateInputConnection(outAttrs);
    if ( ic == null ) {
      return null;
    }

    if ( outAttrs.hintText == null ) {
      // If we don't have a hint and our parent is a TextInputLayout, use it's hint for the
      // EditorInfo. This allows us to display a hint in 'extract mode'.
      final ViewParent parent = getParent();
      if (parent instanceof TextInputLayout) {
        outAttrs.hintText = ((TextInputLayout) parent).getHint();
      }
    }
    return ic;
  }
}

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

@Override
  protected HashMap<String, Object> fillValues(View v, HashMap<String, Object> data, HashMap<String, Object> parentData) {
    super.fillValues(v, data, parentData);

    TextInputLayout view = (TextInputLayout) v;

    data.put("Error", view.getError());
    data.put("Hint", view.getHint());
    data.put("PasswordVisibilityToggleContentDescription", view.getPasswordVisibilityToggleContentDescription());
    data.put("PasswordVisibilityToggleDrawable:", view.getPasswordVisibilityToggleDrawable());
    data.put("Typeface:", view.getTypeface());
    data.put("IsCounterEnabled", view.isCounterEnabled());
    data.put("IsErrorEnabled", view.isErrorEnabled());
    data.put("IsHintAnimationEnabled", view.isHintAnimationEnabled());
    data.put("IsHintEnabled", view.isHintEnabled());
    data.put("IsPasswordVisibilityToggleEnabled", view.isPasswordVisibilityToggleEnabled());

    return data;
  }
}

代码示例来源:origin: braintree/android-card-form

private static void assertTextHintIs(View view, int resourceId) {
  assertEquals(RuntimeEnvironment.application.getString(resourceId),
      ((TextInputLayout) view.getParent().getParent()).getHint());
}

代码示例来源:origin: braintree/android-card-form

@Test
public void hintDefaultsToCvv() {
  assertEquals(((TextInputLayout) mView.getParent().getParent()).getHint(),
      RuntimeEnvironment.application.getString(R.string.bt_cvv));
}

代码示例来源:origin: braintree/android-card-form

@Test
public void setFieldHint_setsHintStringWhenParentViewIsATextInputLayout() {
  mView = (CardEditText) Robolectric.setupActivity(TestActivity.class)
      .findViewById(R.id.bt_card_form_card_number);
  mView.setFieldHint("CVV");
  assertEquals("CVV", ((TextInputLayout) mView.getParent().getParent()).getHint());
  assertEquals("CVV", mView.getHint());
}

代码示例来源:origin: braintree/android-card-form

@Test
public void setFieldHint_setsHintWhenParentViewIsATextInputLayout() {
  mView = (CardEditText) Robolectric.setupActivity(TestActivity.class)
      .findViewById(R.id.bt_card_form_card_number);
  mView.setFieldHint(R.string.bt_form_hint_cvv);
  assertEquals("CVV", ((TextInputLayout) mView.getParent().getParent()).getHint());
  assertEquals("CVV", mView.getHint());
}

代码示例来源:origin: braintree/android-card-form

@Test
public void hintChangesForCardType() {
  for (CardType cardType : CardType.values()) {
    mView.setCardType(cardType);
    assertEquals(RuntimeEnvironment.application.getString(cardType.getSecurityCodeName()),
        mView.getTextInputLayoutParent().getHint());
    assertEquals(RuntimeEnvironment.application.getString(cardType.getSecurityCodeName()),
        mView.getContentDescription());
  }
}

相关文章