本文整理匯總了Java中android.widget.EditText.addTextChangedListener方法的典型用法代碼示例。如果您正苦於以下問題:Java EditText.addTextChangedListener方法的具體用法?Java EditText.addTextChangedListener怎麽用?Java EditText.addTextChangedListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.EditText
的用法示例。
在下文中一共展示了EditText.addTextChangedListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: beautyEditText
import android.widget.EditText; //導入方法依賴的package包/類
protected void beautyEditText(final EditText mEditText, String hintStr, TextWatcher mTextWatcher) {
mEditText.setHint(hintStr);
mEditText.setHintTextColor(Color.parseColor("#1e0d0d0d"));
mEditText.setTextColor(Color.parseColor("#0d0d0d"));
SDKUtils.setBackground(mEditText, this.crMgmt.getDrawable("uac_input", true));
mEditText.setTextSize(16.0f);
if (mTextWatcher != null) {
mEditText.addTextChangedListener(mTextWatcher);
}
mEditText.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mEditText.setSelection(mEditText.length());
mEditText.requestFocus();
mEditText.setFocusable(true);
}
});
}
示例2: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_group_notice);
mEdit = (EditText) findViewById(R.id.edit_area);
Intent intent = getIntent();
mConversationType = Conversation.ConversationType.setValue(intent.getIntExtra("conversationType", 0));
mTargetId = getIntent().getStringExtra("targetId");
setTitle(R.string.group_announcement);
Button rightButton = getHeadRightButton();
rightButton.setVisibility(View.GONE);
mHeadRightText.setVisibility(View.VISIBLE);
mHeadRightText.setText(R.string.Done);
mHeadRightText.setTextColor(getResources().getColor(android.R.color.darker_gray));
mHeadRightText.setClickable(false);
mHeadRightText.setOnClickListener(this);
mEdit.addTextChangedListener(this);
}
示例3: onCreateView
import android.widget.EditText; //導入方法依賴的package包/類
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
View root = inflater.inflate(R.layout.dialog_country_or_city_select, container, false);
EditText input = root.findViewById(R.id.input);
input.setText(filter);
input.addTextChangedListener(new TextWatcherAdapter() {
@Override
public void afterTextChanged(Editable s) {
filter = s.toString();
mHandler.removeCallbacks(mRunSearchRunnable);
mHandler.postDelayed(mRunSearchRunnable, RUN_SEACRH_DELAY);
}
});
mRecyclerView = root.findViewById(R.id.list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
return root;
}
示例4: onCreateView
import android.widget.EditText; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_save, container, false);
view.findViewById(R.id.background).setBackgroundColor(SettingsActivity.getPrimaryColor(getActivity()));
mCancel = (ImageButton) view.findViewById(android.R.id.button2);
mCancel.setOnClickListener(this);
mDisplayName = (EditText) view.findViewById(android.R.id.title);
mDisplayName.addTextChangedListener(mDisplayNameWatcher);
mDisplayName.setText(getArguments().getString(EXTRA_DISPLAY_NAME));
mSave = (ImageButton) view.findViewById(android.R.id.button1);
mSave.setOnClickListener(this);
mSave.setEnabled(false);
mProgress = (ProgressBar) view.findViewById(android.R.id.progress);
return view;
}
示例5: init
import android.widget.EditText; //導入方法依賴的package包/類
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void init() {
eyeNo = resources.getDrawable(R.drawable.eye_no, null);
eyeYes = resources.getDrawable(R.drawable.eye_yes, null);
error = (TextView) dialog.findViewById(R.id.error);
editText = (EditText) dialog.findViewById(R.id.edit);
eye = (ImageView) dialog.findViewById(R.id.eye);
eyeRegion = dialog.findViewById(R.id.eye_region);
clear = (RelativeLayout) dialog.findViewById(R.id.rel_clear);
clear.setVisibility(View.GONE);
clear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editText.setText("");
}
});
eyeRegion.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(pwdVisible){
pwdVisible = false;
eye.setImageDrawable(eyeNo);
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
}else{
pwdVisible = true;
eye.setImageDrawable(eyeYes);
editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
}
editText.setSelection(editText.getText().length());
Log.d(TAG, "onClick:"+pwdVisible);
}
});
editText.addTextChangedListener(textWatcher);
}
示例6: prepareRestoreWalletDialog
import android.widget.EditText; //導入方法依賴的package包/類
private void prepareRestoreWalletDialog(final Dialog dialog) {
final AlertDialog alertDialog = (AlertDialog) dialog;
final View replaceWarningView = alertDialog
.findViewById(R.id.restore_wallet_from_content_dialog_replace_warning);
final boolean hasCoins = wallet.getBalance(BalanceType.ESTIMATED).signum() > 0;
replaceWarningView.setVisibility(hasCoins ? View.VISIBLE : View.GONE);
final EditText passwordView = (EditText) alertDialog
.findViewById(R.id.import_keys_from_content_dialog_password);
passwordView.setText(null);
final ImportDialogButtonEnablerListener dialogButtonEnabler = new ImportDialogButtonEnablerListener(
passwordView, alertDialog) {
@Override
protected boolean hasFile() {
return true;
}
};
passwordView.addTextChangedListener(dialogButtonEnabler);
final CheckBox showView = (CheckBox) alertDialog.findViewById(R.id.import_keys_from_content_dialog_show);
showView.setOnCheckedChangeListener(new ShowPasswordCheckListener(passwordView));
}
示例7: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
logEmailHint = (TextView) findViewById(R.id.logEmailHint);
logEmail = (EditText) findViewById(R.id.logEmail);
logEmailLine = (ImageView) findViewById(R.id.logEmailLine);
logEmailCancel = (ImageView) findViewById(R.id.logEmailCancel);
logPasswordHint = (TextView) findViewById(R.id.logPasswordHint);
logPassword = (EditText) findViewById(R.id.logPassword);
logPasswordLine = (ImageView) findViewById(R.id.logPasswordLine);
logPasswordCancel = (ImageView) findViewById(R.id.logPasswordCancel);
//For Focus
logEmail.setOnFocusChangeListener(hasFocusListener);
logPassword.setOnFocusChangeListener(hasFocusListener);
//For TextChange
logEmail.addTextChangedListener(textLengthListener);
logPassword.addTextChangedListener(textLengthListener);
}
示例8: onCreate
import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
scrollConsole = (ScrollView) findViewById(R.id.scroll_output);
textConsole = (TextView) findViewById(R.id.text_output);
inputConsole = (EditText) findViewById(R.id.edittext_input);
buttonConfirm = (ImageButton) findViewById(R.id.button_confirm);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.chess_coordinatorlayout);
buttonColorEnabled = buttonConfirm.getColorFilter();
enableButton(false);
inputConsole.addTextChangedListener(new ConsoleInputWatcher());
setKeyboardListener();
}
示例9: initPage
import android.widget.EditText; //導入方法依賴的package包/類
private void initPage() {
activity.findViewById(ResHelper.getIdRes(activity, "ll_back")).setOnClickListener(this);
activity.findViewById(ResHelper.getIdRes(activity, "ivSearch")).setOnClickListener(this);
activity.findViewById(ResHelper.getIdRes(activity, "iv_clear")).setOnClickListener(this);
int resId = ResHelper.getIdRes(activity, "clCountry");
listView = (CountryListView) activity.findViewById(resId);
listView.setOnItemClickListener(this);
resId = ResHelper.getIdRes(activity, "et_put_identify");
etSearch = (EditText) activity.findViewById(resId);
etSearch.addTextChangedListener(this);
}
示例10: AddSpaceTextWatcher
import android.widget.EditText; //導入方法依賴的package包/類
public AddSpaceTextWatcher(Activity activity, EditText editText, int maxLenght) {
this.activity=activity;
this.editText = editText;
this.maxLenght = maxLenght;
if (editText == null) {
new NullPointerException("editText is null");
}
spaceType = SpaceType.defaultType;
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(
maxLenght)});
editText.addTextChangedListener(this);
}
示例11: onCreateView
import android.widget.EditText; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_transfer_coins, container, false);
wallet = Wallet.getWorkWallet();
editTextToWallet = (EditText) view.findViewById(R.id.textEditWallet);
editTextCoins = (EditText) view.findViewById(R.id.textEditCoins);
textTotalInWallet = (TextView) view.findViewById(R.id.textTotalInWallet);
imageValidOk = (ImageView) view.findViewById(R.id.textValidOk);
coinsLayout = view.findViewById(R.id.coinsLayout);
frameInput = view.findViewById(R.id.inputWalletLayout);
imageValidOk.setVisibility(View.INVISIBLE);
attachOnClickView(view, R.id.buttonTransfer);
attachOnClickView(view, R.id.buttonScanQR);
attachOnClickView(view, R.id.buttonClear);
progressDialog = new ProgressDialog(getActivity());
updateView();
editTextToWallet.addTextChangedListener(this);
editTextCoins.addTextChangedListener(this);
editTextCoins.setOnKeyListener((v, keyCode, event) -> {
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
if (isValidTransferCash())
new AccountService(this).isExist(editTextToWallet.getText().toString(), REQUEST_IS_EXIST);
return true;
}
return false;
});
return view;
}
示例12: newProjectDialog
import android.widget.EditText; //導入方法依賴的package包/類
private void newProjectDialog() {
mProjectDialog = new LovelyCustomDialog(this, mDarkTheme ? R.style.EditTextTintThemeDark : R.style.EditTextTintTheme)
.setView(R.layout.project_form)
.setTopColor(mPrimaryColor)
.setIcon(R.drawable.ic_notepad)
.setListener(R.id.projectDoneButton, new View.OnClickListener() {
@Override
public void onClick(View v) {
createProjectFromDialog();
}
})
.show();
//get the views
mProjectError = (TextView) mProjectDialog.findViewById(R.id.project_error_message);
mProjectField = (EditText) mProjectDialog.findViewById(R.id.editProjectName);
//hide error when text change
mProjectField.addTextChangedListener(this);
mProjectField.setHighlightColor(Color.LTGRAY);
mProjectField.setOnFocusChangeListener(this);
//request focus on the edit text
if (mProjectField.requestFocus()) {
mProjectDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
示例13: onCreateDialog
import android.widget.EditText; //導入方法依賴的package包/類
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog mDialog = new Dialog(getActivity(), R.style.BottomDialog);
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mDialog.setContentView(R.layout.dialog_fragment_comment_layout);
mDialog.setCanceledOnTouchOutside(true);
Window window = mDialog.getWindow();
WindowManager.LayoutParams layoutParams;
if (window != null) {
layoutParams = window.getAttributes();
layoutParams.gravity = Gravity.BOTTOM;
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
window.setAttributes(layoutParams);
}
commentEditText = (EditText) mDialog.findViewById(R.id.edit_comment);
photoButton = (ImageView) mDialog.findViewById(R.id.image_btn_photo);
atButton = (ImageView) mDialog.findViewById(R.id.image_btn_at);
sendButton = (ImageView) mDialog.findViewById(R.id.image_btn_comment_send);
fillEditText();
setSoftKeyboard();
commentEditText.addTextChangedListener(mTextWatcher);
photoButton.setOnClickListener(this);
atButton.setOnClickListener(this);
sendButton.setOnClickListener(this);
return mDialog;
}
示例14: setupSecondEditText
import android.widget.EditText; //導入方法依賴的package包/類
protected void setupSecondEditText(boolean visible) {
mSecondEditText = (EditText) findViewById(R.id.seconds);
if (visible) {
mSecondEditText.setFilters(new InputFilter[]{new InputFilterMinMax("0", "59"), new InputFilter.LengthFilter(2)});
mSecondEditText.addTextChangedListener(mSecondTextWatcher);
} else {
mSecondEditText.setVisibility(View.GONE);
}
}
示例15: onOptionsItemSelected
import android.widget.EditText; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_show_search_field) {
// change layout params to show search text
EditText searchTextView = (EditText) findViewById(R.id.editTextSearchField);
// text listener to use entered characters in search
searchTextView.addTextChangedListener(textWatcher);
// input manager to start or hide keayboard
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (searchTextView.getLayout().getWidth() == 0) {
// show text for entering search field
searchTextView.setLayoutParams(new Toolbar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
// ... and set focus
searchTextView.requestFocus();
// show keyboard
imm.showSoftInput(searchTextView, InputMethodManager.SHOW_IMPLICIT);
} else {
if (searchTextView.getText().toString().length() > 0) return true;
// hide search field
searchTextView.setLayoutParams(new Toolbar.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT));
// hide keyboard
imm.hideSoftInputFromWindow(searchTextView.getWindowToken(), 0);
}
return true;
} else if (id == R.id.about_program_menu_item) {
Intent intent = new Intent(getApplicationContext(), AboutProgramActivity.class);
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}