本文整理汇总了Java中android.widget.EditText.setImeOptions方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setImeOptions方法的具体用法?Java EditText.setImeOptions怎么用?Java EditText.setImeOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setImeOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EditTextDialogBuilder
import android.widget.EditText; //导入方法依赖的package包/类
public EditTextDialogBuilder(Context context) {
super(context);
mEditText = new EditText(mContext);
mEditText.setHintTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_gray_3));
mEditText.setTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_black));
mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_content_message_text_size));
mEditText.setFocusable(true);
mEditText.setFocusableInTouchMode(true);
mEditText.setImeOptions(EditorInfo.IME_ACTION_GO);
mEditText.setGravity(Gravity.CENTER_VERTICAL);
mEditText.setId(R.id.qmui_dialog_edit_input);
mRightImageView = new ImageView(mContext);
mRightImageView.setId(R.id.qmui_dialog_edit_right_icon);
mRightImageView.setVisibility(View.GONE);
}
示例2: onCreate
import android.widget.EditText; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_anagrams);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
AssetManager assetManager = getAssets();
try {
InputStream inputStream = assetManager.open("words.txt");
dictionary = new AnagramDictionary(new InputStreamReader(inputStream));
} catch (IOException e) {
Toast toast = Toast.makeText(this, "Could not load dictionary", Toast.LENGTH_LONG);
toast.show();
}
// Set up the EditText box to process the content of the box when the user hits 'enter'
final EditText editText = (EditText) findViewById(R.id.editText);
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
editText.setImeOptions(EditorInfo.IME_ACTION_GO);
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_GO) {
processWord(editText);
handled = true;
}
return handled;
}
});
}
示例3: initFilenameInputDialog
import android.widget.EditText; //导入方法依赖的package包/类
public static void initFilenameInputDialog(MaterialDialog show) {
final EditText editText = show.getInputEditText();
editText.setSingleLine();
editText.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER);
editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
// create an initial filename to suggest to the user
String filename = createLogFilename();
editText.setText(filename);
// highlight everything but the .txt at the end
editText.setSelection(0, filename.length() - 4);
}
示例4: onViewCreated
import android.widget.EditText; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
clickHandler = new ClickHandler(this);
txtDialogTitle = (TextView) view.findViewById(R.id.txtDialogTitle);
txtContent = (TextView) view.findViewById(R.id.txtContent);
btnOk = (TextView) view.findViewById(R.id.btnOk);
btnExit = (TextView) view.findViewById(R.id.btnExit);
btnCancel = (TextView) view.findViewById(R.id.btnCancel);
edtLibName = (EditText) view.findViewById(R.id.edtLibName);
btnOk.setOnClickListener(clickHandler);
btnExit.setOnClickListener(clickHandler);
btnCancel.setOnClickListener(clickHandler);
txtContent.setText(content);
btnOk.setText(ok);
btnCancel.setText(cancel);
btnExit.setText(exit);
if (!TextUtils.isEmpty(sDialogTitle)) {
txtDialogTitle.setText(sDialogTitle);
}
if (btnCount == 1) {
btnCancel.setVisibility(View.GONE);
} else if (btnCount == 3) {
btnExit.setVisibility(View.VISIBLE);
}
int visibility = hasEditText ? View.VISIBLE : View.GONE;
edtLibName.setVisibility(visibility);
if (!TextUtils.isEmpty(textContent)) {
edtLibName.setText(textContent);
}
if (!TextUtils.isEmpty(hintText)) {
edtLibName.setHint(hintText);
}
if (isMultiLineEditText) {
edtLibName.setMaxLines(1);
edtLibName.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
edtLibName.setScroller(new Scroller(getContext()));
edtLibName.setVerticalScrollBarEnabled(true);
edtLibName.setMovementMethod(new ScrollingMovementMethod());
}
}