/** * Change the editor type integer associated with the text view, which * will be reported to an IME with {@link EditorInfo#imeOptions} when it * has focus. * @see #getImeOptions * @see EditorInfo * @attr ref android.R.styleable#TextView_imeOptions */ public void setImeOptions (int imeOptions){ mInputView.setImeOptions(imeOptions); }
editText.setTypeface(typeface, 0); editText.setGravity(gravity); editText.setImeOptions(imeOptions); editText.setFocusable(editable); editText.setFocusableInTouchMode(editable);
urlText.setImeOptions(EditorInfo.IME_ACTION_GO); urlText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
editText.setGravity(gravity); editText.setImeOptions(imeOptions); editText.setOnEditorActionListener(editorActionListener);
EditText edText = new EditText(this); edText .setId(i); edText .setLayoutParams(new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)); edText .setWidth(100); edText .setImeOptions(EditorInfo.IME_ACTION_NEXT); edText .setInputType(InputType.TYPE_CLASS_NUMBER); edText .setKeyListener(DigitsKeyListener.getInstance()); edText .setMaxLines(1); edText .setOnFocusChangeListener(this); edText .setOnEditorActionListener(this); edText .addTextChangedListener(this); //this linearlayout id is declared inside your xml file LinearLayout linear=(LinearLayout)findViewById(R.id.linearLayout1); linear.addView(edText );
public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText etname; etname = (EditText) findViewById(R.id.edittext); etname.setImeOptions(EditorInfo.IME_ACTION_DONE); } }
EditText et1 = (EditText)findViewById(R.id.editText1); et1.setImeOptions(EditorInfo.IME_ACTION_NEXT); EditText et2 = (EditText)findViewById(R.id.editText2); et2.setImeOptions(EditorInfo.IME_ACTION_NEXT);
EditText editText = new EditText(this); editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
EditText editText = new EditText(this); editText.setInputType(InputType.TYPE_CLASS_TEXT); editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
private void init(Context context) { LayoutInflater.from(context).inflate(R.layout.widget_simple_search_view, this); ButterKnife.bind(this); etQuery.setImeOptions(EditorInfo.IME_ACTION_SEARCH); etQuery.setInputType(EditorInfo.TYPE_CLASS_TEXT); etQuery.setOnEditorActionListener(this); etQuery.addTextChangedListener(this); }
final RadioGroup btn_group = (RadioGroup) findViewById(R.id.btn_group); final RadioButton btnA = (RadioButton) findViewById(R.id.btnA); final RadioButton btnB = (RadioButton) findViewById(R.id.btnB); btn_group.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { final EditText txtSearch = (EditText) findViewById(R.id.edit_text); txtSearch.setInputType(InputType.TYPE_NULL); if(btnA.isChecked()) { txtSearch.setImeOptions(EditorInfo.IME_ACTION_DONE); } else { txtSearch.setImeOptions(EditorInfo.IME_ACTION_SEARCH); } txtSearch.setInputType(InputType.TYPE_CLASS_TEXT); } });
EditText input = new EditText(context); input.setImeOptions(EditorInfo.IME_ACTION_DONE); input.setImeActionLabel("Guess", EditorInfo.IME_ACTION_DONE);
EditText view = new EditText(this); view.setImeOptions(EditorInfo.IME_ACTION_SEARCH); view.setSingleLine(true);
EditText input = new EditText(context); input.setImeOptions(EditorInfo.IME_ACTION_DONE); input.setImeActionLabel("My Text", EditorInfo.IME_ACTION_DONE);
EditText link_name= (EditText) findViewById(R.id.link_name); link_name.setSingleLine(false); link_name.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
private void changeInputTypeAndImeOptions(EditText fieldValue, int inputType, int imeOption) { if (inputType == InputType.TYPE_NULL) inputType = fieldValue.getInputType(); fieldValue.setImeOptions(imeOption | EditorInfo.IME_FLAG_NO_FULLSCREEN); //Makes the trigger for the imeOptions to change while typing! //fieldValue.setInputType(InputType.TYPE_NULL); fieldValue.setInputType(inputType); InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) imm.restartInput(fieldValue); }
alert.setTitle(R.string.WtsOnYourMind); final EditText input = new EditText(context); input.setHeight(100); input.setWidth(340); input.setGravity(Gravity.LEFT); input.setImeOptions(EditorInfo.IME_ACTION_DONE); alert.setView(input);
private KeyboardHelper(@NonNull Activity activity) { super(activity); this.statusBarHeight = getStatusBarHeight(); setLayoutParams(new ViewGroup.LayoutParams(0, 0)); inputTrap = new EditText(activity); inputTrap.setFocusable(true); inputTrap.setFocusableInTouchMode(true); inputTrap.setVisibility(View.VISIBLE); inputTrap.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI); inputTrap.setInputType(EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES); addView(inputTrap); final View rootView = activity.getWindow().getDecorView().findViewById(Window.ID_ANDROID_CONTENT); rootView.getViewTreeObserver().addOnGlobalLayoutListener(new KeyboardTreeObserver(activity)); }
@Override public View onCreateView(View parent, String name, Context context, AttributeSet attrs) { AppCompatDelegate delegate = getDelegate(); View view = delegate.createView(parent, name, context, attrs); if (view != null && view instanceof EditText) { EditText et = (EditText) view; et.setImeOptions(et.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI); return et; } return view; } });
@Override protected View createQuizContentView() { LinearLayout layout = new LinearLayout(getContext()); layout.setOrientation(LinearLayout.VERTICAL); mAnswerOne = createEditText(); mAnswerOne.setImeOptions(EditorInfo.IME_ACTION_NEXT); mAnswerTwo = createEditText(); mAnswerTwo.setId(R.id.quiz_edit_text_two); addEditText(layout, mAnswerOne); addEditText(layout, mAnswerTwo); return layout; }