本文整理汇总了Java中android.support.design.widget.TextInputLayout.setHint方法的典型用法代码示例。如果您正苦于以下问题:Java TextInputLayout.setHint方法的具体用法?Java TextInputLayout.setHint怎么用?Java TextInputLayout.setHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.TextInputLayout
的用法示例。
在下文中一共展示了TextInputLayout.setHint方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changePacketSelection
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private void changePacketSelection(@NonNull Packet packet) {
final LayoutInflater inflater = getLayoutInflater();
final ViewGroup formContainer = this.formContainer;
TransitionManager.beginDelayedTransition(formContainer, new AutoTransition().setDuration(150));
formContainer.removeAllViews();
final PacketParameter[] parameters = packet.parameters;
final int paramLen = parameters.length;
for (int i = 0; i < paramLen; i++) {
final PacketParameter param = parameters[i];
final TextInputLayout inputLayout = (TextInputLayout) inflater.inflate(R.layout.input_field, formContainer, false);
inputLayout.setTag(param);
inputLayout.setHint(param.id());
final EditText inputField = inputLayout.getEditText();
if (inputField != null) {
inputField.setText(param.value());
}
formContainer.addView(inputLayout);
}
}
示例2: populateSingleValueRow
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private View populateSingleValueRow(LayoutInflater inflater, ViewGroup container, String valueUnits) {
// Instantiate the UI elements
View view = inflater.inflate(R.layout.fragment_add_single_value, container, false);
TextInputLayout firstValueTextInputLayout = (TextInputLayout) view.findViewById(R.id.singleValueTextInputLayout);
EditText dateEditText = (EditText) view.findViewById(R.id.dateEditText);
EditText timeEditText = (EditText) view.findViewById(R.id.timeEditText);
Button cancelButton = (Button) view.findViewById(R.id.cancelButton);
Button acceptButton = (Button) view.findViewById(R.id.acceptButton);
// Set actions to the UI elements
firstValueTextInputLayout.setHint(valueUnits);
removeFocus(firstValueTextInputLayout);
setCancelAction(cancelButton, dateEditText, timeEditText, firstValueTextInputLayout);
setAcceptAction(acceptButton, dateEditText, timeEditText, firstValueTextInputLayout);
setDatePicker(dateEditText);
setTimePicker(timeEditText);
return view;
}
示例3: onCreateDialog
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@SuppressLint("InflateParams")
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));
view.findViewById(R.id.textInputLayout_content).setVisibility(View.GONE);
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
if (getParentFragment() instanceof NoteContainerFragment) {
((NoteContainerFragment) getParentFragment()).search(titleView.getEditText().getText().toString());
} else {
throw new IllegalStateException();
}
break;
}
}
};
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.search)
.setView(view)
.setPositiveButton(android.R.string.ok, onClickListener)
.setNegativeButton(android.R.string.cancel, onClickListener)
.create();
}
示例4: onCreateDialog
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@SuppressLint("InflateParams")
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));
view.findViewById(R.id.textInputLayout_content).setVisibility(View.GONE);
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
new CreateNewNotebookTask(titleView.getEditText().getText().toString())
.start(getParentFragment());
break;
}
}
};
return new AlertDialog.Builder(getActivity())
.setTitle(R.string.create_new_notebook)
.setView(view)
.setPositiveButton(R.string.create, onClickListener)
.setNegativeButton(android.R.string.cancel, onClickListener)
.create();
}
示例5: init
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private void init() {
nameWrapper = (TextInputLayout) findViewById(R.id.nameWrapper);
accountWrapper = (TextInputLayout) findViewById(R.id.accountWrapper);
passwordWrapper = (TextInputLayout) findViewById(R.id.passwordWrapper);
noteWrapper = (TextInputLayout) findViewById(R.id.noteWrapper);
tagWrapper = (TextInputLayout) findViewById(R.id.tagWrapper);
nameWrapper.setHint("名称,比如酷安、酷安小号、酷安女号等");
accountWrapper.setHint("帐户,邮箱、电话、用户名");
passwordWrapper.setHint("密码,点击左侧图标可自动生成哦");
noteWrapper.setHint("备注,回车即可换行");
tagWrapper.setHint("标记,点击选择,输入请用空格隔开,注:可用于归类检索");
et_name = (EditText) findViewById(R.id.et_name);
et_account = (EditText) findViewById(R.id.et_account);
et_password = (EditText) findViewById(R.id.et_password);
et_note = (EditText) findViewById(R.id.et_web);
et_tag = (EditText) findViewById(R.id.et_tag);
btn_get_pwd= (ImageView) findViewById(R.id.btn_get_pwd);
btn_get_pwd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//返回密码
Intent intent = new Intent(AddActivity.this, GetPwdActivity.class);
startActivity(intent);
}
});
}
示例6: onCreateView
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = null;
switch (type) {
case GLUCOSE:
view = populateSingleValueRow(inflater, container, "Value [mmol/L]");
break;
case BLOOD_PRESSURE:
view = inflater.inflate(R.layout.fragment_add_double_value, container, false);
TextInputLayout firstValueTextInputLayout = (TextInputLayout) view.findViewById(R.id.firstValueTextInputLayout);
TextInputLayout secondValueTextInputLayout = (TextInputLayout) view.findViewById(R.id.secondValueTextInputLayout);
EditText dateEditText = (EditText) view.findViewById(R.id.dateEditText);
EditText timeEditText = (EditText) view.findViewById(R.id.timeEditText);
Button cancelButton = (Button) view.findViewById(R.id.cancelButton);
Button acceptButton = (Button) view.findViewById(R.id.acceptButton);
firstValueTextInputLayout.setHint("Systolic [mmHg]");
secondValueTextInputLayout.setHint("Diastolic [mmHg]");
removeFocus(firstValueTextInputLayout, secondValueTextInputLayout);
setCancelAction(cancelButton, dateEditText, timeEditText, firstValueTextInputLayout, secondValueTextInputLayout);
setAcceptAction(acceptButton, dateEditText, timeEditText, firstValueTextInputLayout, secondValueTextInputLayout);
setDatePicker(dateEditText);
setTimePicker(timeEditText);
break;
case WEIGHT:
view = populateSingleValueRow(inflater, container, "Value [kg]");
break;
}
return view;
}
示例7: onCreateDialog
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// creazione 'manuale' del dialog
int margin = getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);
LinearLayout rootView = new LinearLayout(getActivity());
rootView.setOrientation(LinearLayout.VERTICAL);
rootView.setPadding(margin, margin, margin, margin);
mTxtInput = new TextInputLayout(getActivity());
mTxtInput.addView(new EditText(getActivity()));
mTxtInput.setHint(getString(R.string.api_key_title));
if (mTxtInput.getEditText() != null) {
mTxtInput.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
mTxtInput.getEditText().setHighlightColor(Color.YELLOW);
}
rootView.addView(mTxtInput);
// Setto l'edit text con il testo dell'api key se presente
String apiKey = SharedPrefsHelper.getInstance().getApiKey(getActivity());
if(apiKey != null)
mTxtInput.getEditText().setText(apiKey);
AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setTitle(getString(R.string.title_insert_api_key))
.setView(rootView)
//.setCancelable(false)
.setPositiveButton(getString(R.string.salva), null)
.setNegativeButton(SharedPrefsHelper.getInstance()
.isApiKeyRegistered(getActivity()) ? getString(R.string.annulla) : getString(R.string.esci_app), this)
.create();
dialog.setOnShowListener(this);
return dialog;
}
示例8: setItemViewLabel
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
@Override
protected void setItemViewLabel( View itemView, String label){
TextInputLayout til = itemView.findViewById( R.id.til_input_wrapper);
til.setHint( label );
}