本文整理汇总了Java中android.support.design.widget.TextInputLayout.addView方法的典型用法代码示例。如果您正苦于以下问题:Java TextInputLayout.addView方法的具体用法?Java TextInputLayout.addView怎么用?Java TextInputLayout.addView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.TextInputLayout
的用法示例。
在下文中一共展示了TextInputLayout.addView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addAnswerByButton
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
@OnClick(R.id.addAnswerButton)
public void addAnswerByButton(View view) {
if (getAnswersCount() >= MAX_ANSWERS) {
Snackbar.make(view, getString(R.string.maxOfAnswers), Snackbar.LENGTH_SHORT).show();
return;
}
TextInputLayout textInputLayout = createTextInputLayout();
textInputLayout.addView(createEditText());
inputLayout.addView(textInputLayout);
}
示例2: addAnswer
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public void addAnswer(String answer) {
TextInputLayout textInputLayout = createTextInputLayout();
EditText editText = createEditText();
editText.setText(answer);
textInputLayout.addView(editText);
inputLayout.addView(textInputLayout);
}
示例3: createAndAddEditText
import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private void createAndAddEditText(String res){
TextInputLayout textInputLayout = createTextInputLayout();
EditText editText = createEditText();
editText.setText(res);
textInputLayout.addView(editText);
linearLayout.addView(textInputLayout);
}
示例4: 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;
}