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

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

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

TextInputLayout.setHint介绍

暂无

代码示例

代码示例来源:origin: seven332/EhViewer

@SuppressLint("InflateParams")
public EditTextDialogBuilder(Context context, String text, String hint) {
  super(context);
  View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_edittext_builder, null);
  setView(view);
  mTextInputLayout = (TextInputLayout) view;
  mEditText = (EditText) view.findViewById(R.id.edit_text);
  mEditText.setText(text);
  mEditText.setSelection(mEditText.getText().length());
  mEditText.setOnEditorActionListener(this);
  mTextInputLayout.setHint(hint);
}

代码示例来源:origin: Cleveroad/AdaptiveTableLayout

private void updateUiAccordingToModel() {
  mTilValue.setHint(mTitle);
  mEtValue.setText(mValue);
  if (mColumn == ZERO_COLUMN_OR_ROW) {
    mTvDelete.setText(getString(R.string.delete_row));
    mTvAdd.setText(getString(R.string.add_row));
  } else if (mRow == ZERO_COLUMN_OR_ROW) {
    mTvDelete.setText(getString(R.string.delete_column));
    mTvAdd.setText(getString(R.string.add_column));
  } else {
    mTvDelete.setVisibility(View.GONE);
    mTvAdd.setVisibility(View.GONE);
  }
}

代码示例来源:origin: alexive/visual-goodies

/**
 * Sets the dialog's text field's hint. This will be displayed when the text field is empty.
 * {@link EditText#setHint(CharSequence)}
 */
public TextInputDialog setTextHint(CharSequence hint){
  mDialogView.setHint(hint);
  return this;
}

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

@Override
  protected void setItemViewLabel( View itemView, String label){
    TextInputLayout til = itemView.findViewById( R.id.til_input_wrapper);
    til.setHint( label );
  }
}

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

@Override
  protected void setItemViewLabel( View itemView, String label){
    TextInputLayout til = itemView.findViewById( R.id.til_input_wrapper);
    til.setHint( label );
  }
}

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

@Override
protected void setItemViewLabel( View itemView, String label){
  TextInputLayout til = itemView.findViewById( R.id.til_input_wrapper);
  til.setHint( label );
}

代码示例来源:origin: fasteque/rgb-tool

/**
 * Set hint for TextInputLayout
 *
 * @see TextInputLayout#setHint(CharSequence)
 */
public void setHint(@StringRes int hint) {
  mInputContainer.setHint(mContext.getString(hint));
}

代码示例来源:origin: zaynr/Carpool-Android-Client

@Override
  public void onClick(View view) {
    TextInputLayout layout = (TextInputLayout) findViewById(R.id.login_account);
    if(mCheckBoxView.isChecked()){
      layout.setHint("手机号");
      loginType = 1;
    } else{
      layout.setHint("公司工号");
      loginType = 0;
    }
  }
});

代码示例来源:origin: zaynr/Carpool-Android-Client

@Override
  public void onClick(View view) {
    TextInputLayout layout = (TextInputLayout) findViewById(R.id.login_account);
    if(mCheckBoxView.isChecked()){
      layout.setHint("手机号");
      loginType = 1;
    } else{
      layout.setHint("公司工号");
      loginType = 0;
    }
  }
});

代码示例来源:origin: openmrs/openmrs-contrib-android-client

@Override
  public void onFocusChange(View view, boolean hasFocus) {
    if (hasFocus) {
      mUsername.setHint("");
      mUsernameInput.setHint(Html.fromHtml(getString(R.string.login_username_hint)));
    } else if (mUsername.getText().toString().equals("")) {
      mUsername.setHint(Html.fromHtml(getString(R.string.login_username_hint) + getString(R.string.req_star)));
      mUsernameInput.setHint("");
    }
  }
});

代码示例来源:origin: openmrs/openmrs-contrib-android-client

@Override
  public void onFocusChange(View view, boolean hasFocus) {
    if (hasFocus) {
      mPassword.setHint("");
      mPasswordInput.setHint(Html.fromHtml(getString(R.string.login_password_hint)));
    } else if (mPassword.getText().toString().equals("")) {
      mPassword.setHint(Html.fromHtml(getString(R.string.login_password_hint) + getString(R.string.req_star)));
      mPasswordInput.setHint("");
    }
  }
});

代码示例来源:origin: unixzii/android-SpringAnimator

public void bindAdjustmentInfo(BaseAdjustmentFragment.AdjustmentInfo info) {
  mAdjustmentInfo = info;
  mLabelTextView.setText(info.propertyName);
  ((TextInputLayout) mInputViewLayout).setHint(info.propertyName);
  mSeekBar.setMax(info.maxValue - info.minValue);
  mSeekBar.setProgress(info.defaultValue - info.minValue);
  mValueTextView.setText(String.valueOf(info.defaultValue));
  mEditText.setText(mValueTextView.getText());
}

代码示例来源:origin: 18Gray/ProCamera

@Override
protected void onCreate(Bundle savedInstanceState)
{
  super.onCreate(savedInstanceState);
  setContentView(R.layout.aty_mine);
  ButterKnife.bind(this);
  context = this;
  et_name = til_name_mine.getEditText();
  til_name_mine.setHint("请输入姓名:");
  et_password = til_password_mine.getEditText();
  til_password_mine.setHint("请输入密码:");
  snackBarView = LayoutInflater.from(context).inflate(R.layout.view_snackbar, null);
  btn_mine.setOnClickListener(new View.OnClickListener()
  {
    @Override
    public void onClick(View view)
    {
      showSnackBar();
    }
  });
}

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

View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_create_note, null);
final TextInputLayout titleView = (TextInputLayout) view.findViewById(R.id.textInputLayout_title);
titleView.setHint(getString(R.string.notebook_title));

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

View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_create_note, null);
final TextInputLayout titleView = (TextInputLayout) view.findViewById(R.id.textInputLayout_title);
titleView.setHint(getString(R.string.query));

代码示例来源:origin: journey-M/AutoMissingMessage

private void initView() {
  msgweQueeView = (MessagQuenView) findViewById(R.id.msgQuenView);
  thumbContainer = (RelativeLayout) findViewById(R.id.thumbContainer);
  txtLayout = (TextInputLayout) findViewById(R.id.txtLayout);
  mEdMsg = txtLayout.getEditText();
  txtLayout.setHint("输入要发送的消息内容");
  btnSendMsg = (Button) findViewById(R.id.btn_sendmsg);
  btnThumbs = (Button) findViewById(R.id.btn_thumb);
  btnJoin = (Button) findViewById(R.id.btn_join);
  btnThumbs.setOnClickListener(this);
  btnSendMsg.setOnClickListener(this);
  btnJoin.setOnClickListener(this);
  Toast.makeText(this, "a", Toast.LENGTH_SHORT).show();
}

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

/**
 * Sets the hint on the {@link TextInputLayout} if this view is a child of a {@link TextInputLayout}, otherwise
 * sets the hint on this {@link android.widget.EditText}.
 *
 * @param hint The string value to use as the hint.
 */
public void setFieldHint(String hint) {
  if (getTextInputLayoutParent() != null) {
    getTextInputLayoutParent().setHint(hint);
  } else {
    setHint(hint);
  }
}

代码示例来源:origin: openmrs/openmrs-contrib-android-client

@Override
  public void onFocusChange(View view, boolean hasFocus) {
    if (StringUtils.notEmpty(mUrl.getText().toString())
        && !view.isFocused()
        && loginValidatorWatcher.isUrlChanged()
        || (loginValidatorWatcher.isUrlChanged() && !view.isFocused()
        && loginValidatorWatcher.isLocationErrorOccurred())
        || (!loginValidatorWatcher.isUrlChanged() && !view.isFocused())) {
      ((LoginFragment) getActivity()
          .getSupportFragmentManager()
          .findFragmentById(R.id.loginContentFrame))
          .setUrl(mUrl.getText().toString());
      loginValidatorWatcher.setUrlChanged(false);
    }
    if (hasFocus) {
      mUrl.setHint("");
      mUrlInput.setHint(Html.fromHtml(getString(R.string.login_url_hint)));
    } else if (mUrl.getText().toString().equals("")) {
      mUrl.setHint(Html.fromHtml(getString(R.string.login_url_hint) + getString(R.string.req_star)));
      mUrlInput.setHint("");
    }
  }
});

代码示例来源:origin: apptentive/apptentive-android

public SurveyQuestionChoice(Context context, LayoutInflater inflater, AnswerDefinition answerDefinition, int questionType, int index) {
  super(context);
  this.index = index;
  answerId = answerDefinition.getId();
  isOtherType = answerDefinition.getType().equals(AnswerDefinition.TYPE_OTHER);
  switch (questionType) {
    case Question.QUESTION_TYPE_MULTICHOICE:
      inflater.inflate(R.layout.apptentive_survey_question_multichoice_choice, this);
      break;
    case Question.QUESTION_TYPE_MULTISELECT:
    default:
      inflater.inflate(R.layout.apptentive_survey_question_multiselect_choice, this);
      break;
  }
  checkBox = (CheckBox) findViewById(R.id.checkbox);
  otherTextInputLayout = (TextInputLayout) findViewById(R.id.other_text_input_layout);
  otherTextInput = (EditText) findViewById(R.id.other_edit_text);
  checkBox.setText(answerDefinition.getValue());
  if (isOtherType) {
    otherTextInputLayout.setHint(answerDefinition.getHint());
  }
  checkBox.setOnCheckedChangeListener(this);
  if (isOtherType) {
    otherTextInput.addTextChangedListener(this);
  }
}

代码示例来源:origin: TrustWallet/trust-wallet-android-source

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  AndroidInjection.inject(this);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_send);
  toolbar();
  viewModel = ViewModelProviders.of(this, sendViewModelFactory)
      .get(SendViewModel.class);
  toInputLayout = findViewById(R.id.to_input_layout);
  toAddressText = findViewById(R.id.send_to_address);
  amountInputLayout = findViewById(R.id.amount_input_layout);
  amountText = findViewById(R.id.send_amount);
  contractAddress = getIntent().getStringExtra(C.EXTRA_CONTRACT_ADDRESS);
  decimals = getIntent().getIntExtra(C.EXTRA_DECIMALS, C.ETHER_DECIMALS);
  symbol = getIntent().getStringExtra(C.EXTRA_SYMBOL);
  symbol = symbol == null ? C.ETH_SYMBOL : symbol;
  sendingTokens = getIntent().getBooleanExtra(C.EXTRA_SENDING_TOKENS, false);
  setTitle(getString(R.string.title_send) + " " + symbol);
  amountInputLayout.setHint(getString(R.string.hint_amount) + " " + symbol);
  // Populate to address if it has been passed forward
  String toAddress = getIntent().getStringExtra(C.EXTRA_ADDRESS);
  if (toAddress != null) {
    toAddressText.setText(toAddress);
  }
  ImageButton scanBarcodeButton = findViewById(R.id.scan_barcode_button);
  scanBarcodeButton.setOnClickListener(view -> {
    Intent intent = new Intent(getApplicationContext(), BarcodeCaptureActivity.class);
    startActivityForResult(intent, BARCODE_READER_REQUEST_CODE);
  });
}

相关文章