當前位置: 首頁>>代碼示例>>Java>>正文


Java EditText.addTextChangedListener方法代碼示例

本文整理匯總了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);
        }
    });
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:18,代碼來源:BasicActivity.java

示例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);
}
 
開發者ID:LanguidSheep,項目名稱:sealtalk-android-master,代碼行數:19,代碼來源:GroupNoticeActivity.java

示例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;
}
 
開發者ID:PhoenixDevTeam,項目名稱:Phoenix-for-VK,代碼行數:23,代碼來源:SelectCityDialog.java

示例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;
}
 
開發者ID:gigabytedevelopers,項目名稱:FireFiles,代碼行數:22,代碼來源:SaveFragment.java

示例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);
}
 
開發者ID:teisun,項目名稱:SunmiUI,代碼行數:37,代碼來源:EditPwdDialog.java

示例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));
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:25,代碼來源:RestoreWalletActivity.java

示例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);

}
 
開發者ID:PacktPublishing,項目名稱:Expert-Android-Programming,代碼行數:25,代碼來源:LoginActivity.java

示例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();
}
 
開發者ID:android-gamecollection,項目名稱:gamecollection,代碼行數:17,代碼來源:ConsoleChess.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:14,代碼來源:CountryPage.java

示例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);
}
 
開發者ID:wenzhimin,項目名稱:BootStepView,代碼行數:13,代碼來源:AddSpaceTextWatcher.java

示例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;
}
 
開發者ID:humaniq,項目名稱:humaniq-android,代碼行數:40,代碼來源:TransferCoinsFragment.java

示例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);
        }

    }
 
開發者ID:IdeaTrackerPlus,項目名稱:IdeaTrackerPlus,代碼行數:30,代碼來源:MainActivity.java

示例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;
}
 
開發者ID:showzeng,項目名稱:PureComment,代碼行數:34,代碼來源:CommentDialogFragment.java

示例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);
    }
}
 
開發者ID:ChessCom,項目名稱:android-chessclock,代碼行數:10,代碼來源:TimePickerView.java

示例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);
}
 
開發者ID:white-collar,項目名稱:mobile-grammar,代碼行數:38,代碼來源:AllArticlesListViewActivity.java


注:本文中的android.widget.EditText.addTextChangedListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。