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


Java AppCompatEditText類代碼示例

本文整理匯總了Java中android.support.v7.widget.AppCompatEditText的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatEditText類的具體用法?Java AppCompatEditText怎麽用?Java AppCompatEditText使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AppCompatEditText類屬於android.support.v7.widget包,在下文中一共展示了AppCompatEditText類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.status_add_new);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("發送微博");

    final AppCompatEditText editText = (AppCompatEditText) findViewById(R.id.inputText);

    findViewById(R.id.send).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String status = editText.getText().toString();
            new UpdateStatusAsync().execute(status);
        }
    });


}
 
開發者ID:aollio,項目名稱:weixzz-app,代碼行數:20,代碼來源:NewStatusActivity.java

示例2: init

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
protected void init(Context context, AttributeSet attrs) {
    setOrientation(VERTICAL);
    inflate(context, R.layout.layout_delete_on_swipe_edit_text, this);
    editText = (AppCompatEditText) getChildAt(0);
    //Threshold cannot be bigger than EditText itself
    if (attrs != null) {
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.DeleteOnSwipeEditText);
        setHint(ta.getString(R.styleable.DeleteOnSwipeEditText_android_hint));
        int threshold = ta.getInt(R.styleable.DeleteOnSwipeEditText_hrskrs_threshold, INVALID);
        if (threshold > MIN_THRESHOLD) {
            DEFAULT_THRESHOLD = threshold;
        }
        int swipeMode = ta.getInt(R.styleable.DeleteOnSwipeEditText_hrskrs_swipe_mode, INVALID);
        if (swipeMode == 1) {
            DEFAULT_SWIPE = SINGLE_FINGER_SWIPE;
        }
        ta.recycle();
    }
    //EditText touch listener
    editText.setOnTouchListener(this);
}
 
開發者ID:hrskrs,項目名稱:GestureFun,代碼行數:22,代碼來源:DeleteOnSwipeEditText.java

示例3: getFirstBadResultOrSuccess

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
public static RxVerifyCompacResult<AppCompatEditText> getFirstBadResultOrSuccess(
        List<RxVerifyCompacResult<AppCompatEditText>> results) {
    RxVerifyCompacResult<AppCompatEditText> firstBadResult = null;
    for (RxVerifyCompacResult<AppCompatEditText> result : results) {
        if (!result.isProper()) {
            firstBadResult = result;
            break;
        }
    }
    if (firstBadResult == null) {
        // if there is no bad result, then return first success
        return results.get(0);
    } else {
        return firstBadResult;
    }
}
 
開發者ID:datalink747,項目名稱:Rx_java2_soussidev,代碼行數:17,代碼來源:VerifyCompacResultHelper.java

示例4: onCreateView

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_buildprop_search, container, false);

    AppCompatEditText keyEdit = (AppCompatEditText) rootView.findViewById(R.id.key_edittext);
    AppCompatEditText valueEdit = (AppCompatEditText) rootView.findViewById(R.id.value_edittext);

    keyEdit.addTextChangedListener(mKeyWatcher);
    valueEdit.addTextChangedListener(mValueWatcher);

    if (mKeyText != null) {
        keyEdit.append(mKeyText);
    }
    if (mValueText != null) {
        valueEdit.append(mValueText);
    }

    mItemsText = (TextView) rootView.findViewById(R.id.found_text);
    setCount(mItemsCount);

    return rootView;
}
 
開發者ID:morogoku,項目名稱:MTweaks-KernelAdiutorMOD,代碼行數:25,代碼來源:BuildpropFragment.java

示例5: onCreate

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_editor);

    initToolBar();
    String title = getIntent().getStringExtra(TITLE_INTENT);
    if (title != null) {
        getSupportActionBar().setTitle(title);
    }

    CharSequence text = getIntent().getCharSequenceExtra(TEXT_INTENT);
    mEditText = (AppCompatEditText) findViewById(R.id.edittext);
    if (text != null) {
        mEditText.append(text);
    }
}
 
開發者ID:morogoku,項目名稱:MTweaks-KernelAdiutorMOD,代碼行數:18,代碼來源:EditorActivity.java

示例6: onViewCreated

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    editGeohash = (AppCompatEditText) view.findViewById(R.id.edit_hash);
    editLat = (AppCompatEditText) view.findViewById(R.id.edit_lat);
    editLon = (AppCompatEditText) view.findViewById(R.id.edit_lon);
    textPrecision = (AppCompatTextView) view.findViewById(R.id.text_precision);
    seekPrecision = (AppCompatSeekBar) view.findViewById(R.id.seek_precision);

    editGeohash.addTextChangedListener(hashTextWatcher);
    editLat.addTextChangedListener(locationTextWatcher);
    editLon.addTextChangedListener(locationTextWatcher);
    seekPrecision.setOnSeekBarChangeListener(this);

    location = new Location("geohash_example");
    textPrecision.setText("Precision: " + 1);
}
 
開發者ID:drfonfon,項目名稱:android-geohash,代碼行數:18,代碼來源:ConverterFragment.java

示例7: getInputDialog

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
/**
 * 獲取一個輸入對話框
 */
public static AlertDialog.Builder getInputDialog(
        Context context,
        String title,
        AppCompatEditText editText,
        String positiveText,
        String negativeText,
        boolean cancelable,
        DialogInterface.OnClickListener positiveListener,
        DialogInterface.OnClickListener negativeListener) {
    return getDialog(context)
            .setCancelable(cancelable)
            .setTitle(title)
            .setView(editText)
            .setPositiveButton(positiveText, positiveListener)
            .setNegativeButton(negativeText, negativeListener);
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:20,代碼來源:DialogHelper.java

示例8: setTint

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
public static void setTint(@NonNull EditText editText, @ColorInt int color, boolean useDarker) {
    final ColorStateList editTextColorStateList = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_enabled},
            new int[]{android.R.attr.state_enabled, -android.R.attr.state_pressed, -android.R.attr.state_focused},
            new int[]{}
    }, new int[]{
            ContextCompat.getColor(editText.getContext(), useDarker ? R.color.ate_text_disabled_dark : R.color.ate_text_disabled_light),
            ContextCompat.getColor(editText.getContext(), useDarker ? R.color.ate_control_normal_dark : R.color.ate_control_normal_light),
            color
    });
    if (editText instanceof AppCompatEditText) {
        ((AppCompatEditText) editText).setSupportBackgroundTintList(editTextColorStateList);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        editText.setBackgroundTintList(editTextColorStateList);
    }
    setCursorTint(editText, color);
}
 
開發者ID:GlennioTech,項目名稱:MetadataEditor,代碼行數:18,代碼來源:TintHelper.java

示例9: initView

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
private void initView() {

        btnSave = (Button) findViewById(R.id.btnSave);
        btnSave.setOnClickListener(this);
        btndel = (Button) findViewById(R.id.btndel);
        btndel.setOnClickListener(this);
        btnupdate = (Button) findViewById(R.id.btnupdate);
        btnupdate.setOnClickListener(this);
        btnQuery = (Button) findViewById(R.id.btnQuery);
        btnQuery.setOnClickListener(this);
        tvTextView = (TextView) findViewById(R.id.tv);
        tvTextView.setFocusable(true);

        etFirstName = (AppCompatEditText) findViewById(R.id.etFirstName);
        etFirstName.setOnClickListener(this);
        btn_back = (ImageView) findViewById(R.id.btn_back);
        btn_back.setOnClickListener(this);
    }
 
開發者ID:longtaoge,項目名稱:SelectName,代碼行數:19,代碼來源:SelectActivity.java

示例10: showAddDialog

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
private void showAddDialog() {
    View customView = LayoutInflater.from(this).inflate(R.layout.dialog_book_add, null);
    final AppCompatEditText editText = ButterKnife.findById(customView, R.id.inputEditText);

    materialDialog = new MaterialDialog.Builder(this)
            .customView(customView, false)
            .positiveColorRes(R.color.positive_color)
            .negativeColorRes(R.color.positive_color)
            .positiveText(R.string.action_sure)
            .negativeText(R.string.action_cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    String name = editText.getText().toString();
                    addBook(name);
                }
            })
            .build();


    materialDialog.show();
}
 
開發者ID:iFarSeer,項目名稱:AidlBestPractice,代碼行數:23,代碼來源:MainActivity.java

示例11: showFilterDialog

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
private void showFilterDialog() {
    View customView = LayoutInflater.from(this).inflate(R.layout.dialog_book_filter, null);
    final AppCompatEditText editText = ButterKnife.findById(customView, R.id.inputEditText);

    materialDialog = new MaterialDialog.Builder(this)
            .customView(customView, false)
            .positiveColorRes(R.color.positive_color)
            .negativeColorRes(R.color.positive_color)
            .positiveText(R.string.action_sure)
            .negativeText(R.string.action_cancel)
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    String filter = editText.getText().toString();
                    filterBookList(filter);
                }
            })
            .build();


    materialDialog.show();
}
 
開發者ID:iFarSeer,項目名稱:AidlBestPractice,代碼行數:23,代碼來源:MainActivity.java

示例12: onCreate

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_text_block);
    ButterKnife.bind(this);

    mTextBlock.setOnUpdateViewListener(new EditTextBlock.UpdateViewListener() {
        @Override
        public void onRemove(EditTextBlock editTextBlock) {
            mLayout.removeView(editTextBlock);
        }

        @Override
        public void onEditTextFocusChange(AppCompatEditText v, boolean hasFocus, EditTextBlock textBlock) {
            Snackbar.make(mLayout,"焦點改變",Snackbar.LENGTH_SHORT).show();
        }
    });
}
 
開發者ID:LimeVista,項目名稱:EasyUtils,代碼行數:19,代碼來源:TestETBActivity.java

示例13: onCreateView

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_login, container, false);

    loginName = (AppCompatEditText) view.findViewById(R.id.login_name);
    loginPassword = (AppCompatEditText) view.findViewById(R.id.login_password);

    AppCompatButton signInButton = (AppCompatButton) view.findViewById(R.id.sign_in_button);
    signInButton.setOnClickListener(__ -> {
        if (isInputDataValid()) {
            String name = loginName.getText().toString();
            String password = loginPassword.getText().toString();
            mPresenter.saveUser(name, password);
            mPresenter.attemptLogin(name, password, false);
        } else {
            showInputDataError();
        }
    });
    return view;
}
 
開發者ID:agenthun,項目名稱:ESeal,代碼行數:23,代碼來源:LoginFragment.java

示例14: setTint

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
public static void setTint(@NonNull EditText editText, @ColorInt int color, boolean useDarker) {
    final ColorStateList editTextColorStateList = new ColorStateList(new int[][]{
            new int[]{-android.R.attr.state_enabled},
            new int[]{android.R.attr.state_enabled, -android.R.attr.state_pressed, -android.R.attr.state_focused},
            new int[]{}
    }, new int[]{
            ContextCompat.getColor(editText.getContext(), useDarker ? R.color.ate_disabled_edittext_dark : R.color.ate_disabled_edittext_light),
            Util.resolveColor(editText.getContext(), R.attr.colorControlNormal),
            color
    });
    if (editText instanceof AppCompatEditText) {
        ((AppCompatEditText) editText).setSupportBackgroundTintList(editTextColorStateList);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        editText.setBackgroundTintList(editTextColorStateList);
    }
}
 
開發者ID:cseshaiban,項目名稱:app-theme-engine-master,代碼行數:17,代碼來源:TintHelper.java

示例15: showEditDialog

import android.support.v7.widget.AppCompatEditText; //導入依賴的package包/類
private void showEditDialog(TodoItem item) {

        View customView = LayoutInflater.from(this).inflate(R.layout.dialog_todo_edit, null);
        final AppCompatEditText editText = ButterKnife.findById(customView, R.id.inputEditText);
        editText.setText(item.getDescription());
        editText.setSelection(item.getDescription().length());

        materialDialog = new MaterialDialog.Builder(this)
                .customView(customView, false)
                .positiveColorRes(R.color.positive_color)
                .negativeColorRes(R.color.positive_color)
                .positiveText(R.string.action_sure)
                .negativeText(R.string.action_cancel)
                .onPositive((dialog, which) -> {
                    String text = editText.getText().toString();
                    if (!TextUtils.isEmpty(text)) {
                        actionCreator.createItemEditAction(item.getId(), text, item.isCompleted(), item.isStared());
                        dialog.dismiss();
                    }
                })
                .build();


        materialDialog.show();
    }
 
開發者ID:iFarSeer,項目名稱:TodoFluxArchitecture,代碼行數:26,代碼來源:TodoListActivity.java


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