下面列出了android.widget.EditText#setImeActionLabel ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void initializeResources() {
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setCustomView(R.layout.centered_app_title);
ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);
passphraseText = (EditText) findViewById(R.id.passphrase_edit);
SpannableString hint = new SpannableString(" " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
passphraseText.setHint(hint);
okButton.setOnClickListener(new OkButtonClickListener());
passphraseText.setOnEditorActionListener(new PassphraseActionListener());
passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
EditorInfo.IME_ACTION_DONE);
}
/**
* Get the Edit Text for this fragment
*
* @param parent the view parent
* @return the {@link EditText}
*/
public EditText getEditText(@NonNull final View parent) {
if (DEBUG) {
MyLog.i(CLS_NAME, "getEditText");
}
final EditText editText = (EditText) parent.findViewById(R.id.etCommand);
editText.setOnEditorActionListener(getParent());
editText.setImeActionLabel(getParent().getString(R.string.menu_run), EditorInfo.IME_ACTION_GO);
return editText;
}
private void initView() {
container = findViewById(R.id.fl_container);
llInput = (LinearLayout) findViewById(R.id.ll_input);
llEditing = (LinearLayout) findViewById(R.id.ll_editing);
tvError = (TextView) findViewById(R.id.tv_error);
etOldPassword = (EditText) findViewById(R.id.et_old_password);
etNewPassword = (EditText) findViewById(R.id.et_new_password);
etNewPasswordConfirm = (EditText) findViewById(R.id.et_new_password_confirm);
btnOk = (Button) findViewById(R.id.btn_ok);
tvPasswordStrength = (TextView) findViewById(R.id.tv_password_strength);
pbPasswordStrength = (ProgressBar) findViewById(R.id.pb_password_strength);
flPasswordStrength = (FrameLayout) findViewById(R.id.fl_password_strength);
flPasswordStrengthContainer = (FrameLayout) findViewById(R.id
.fl_password_strength_container);
kv = (PasswordEntryKeyboardView) findViewById(R.id.kv);
PasswordWatcher watcher = new PasswordWatcher();
etOldPassword.addTextChangedListener(watcher);
etNewPassword.addTextChangedListener(watcher);
etNewPasswordConfirm.addTextChangedListener(watcher);
btnOk.setOnClickListener(this);
findViewById(R.id.btn_cancel).setOnClickListener(this);
btnOk.setEnabled(false);
passwordCheck.setCheckListener(this);
etOldPassword.setImeActionLabel(null, EditorInfo.IME_ACTION_NEXT);
etNewPassword.setImeActionLabel(null, EditorInfo.IME_ACTION_NEXT);
etNewPasswordConfirm.setImeActionLabel(null, EditorInfo.IME_ACTION_DONE);
etNewPasswordConfirm.setOnEditorActionListener(this);
kv.registerEditText(etOldPassword, etNewPassword, etNewPasswordConfirm);
}
/**
* Constructor
* @param wav parent activity
* @param wv the integrated browser
*/
public LocalIMEKeyboard (WebReviewActivity wav, FocusWebView wv)
{
Resources res;
this.wav = wav;
this.wv = wv;
editable = true;
bpos = new BoxPosition ();
imm = (InputMethodManager) wav.getSystemService (Context.INPUT_METHOD_SERVICE);
disableSuggestions = PrefManager.getNoSuggestion() | PrefManager.getRomaji();
dm = wav.getResources ().getDisplayMetrics ();
ime = new JapaneseIME ();
ew = (EditText) wav.findViewById (R.id.ime);
divw = wav.findViewById (R.id.ime_div);
imel = new IMEListener ();
ew.addTextChangedListener (imel);
ew.setInputType (InputType.TYPE_CLASS_TEXT);
ew.setOnEditorActionListener (imel);
ew.setGravity (Gravity.CENTER);
ew.setImeActionLabel (">>", EditorInfo.IME_ACTION_DONE);
ew.setImeOptions (EditorInfo.IME_ACTION_DONE);
qvw = (TextView) wav.findViewById (R.id.txt_question_override);
next = (Button) wav.findViewById (R.id.ime_next);
next.setOnClickListener (imel);
srsv = wav.findViewById (R.id.v_srs);
jsl = new JSListener ();
wv.addJavascriptInterface (jsl, "wknJSListener");
wki = new WaniKaniImprove (wav, wv);
wv.registerListener (new WebViewListener ());
res = wav.getResources ();
correctFG = res.getColor (R.color.correctfg);
incorrectFG = res.getColor (R.color.incorrectfg);
ignoredFG = res.getColor (R.color.ignoredfg);
setupSRSColors (res);
correctBG = R.drawable.card_reviews_edittext_correct;
incorrectBG = R.drawable.card_reviews_edittext_incorrect;
ignoredBG = R.drawable.card_reviews_edittext_ignored;
cmap = new EnumMap<WaniKaniItem.Type, Integer> (WaniKaniItem.Type.class);
cmap.put (WaniKaniItem.Type.RADICAL, res.getColor (R.color.wanikani_radical));
cmap.put (WaniKaniItem.Type.KANJI, res.getColor (R.color.wanikani_kanji));
cmap.put (WaniKaniItem.Type.VOCABULARY, res.getColor (R.color.wanikani_vocabulary));
}