本文整理匯總了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());
}
}