当前位置: 首页>>代码示例>>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;未经允许,请勿转载。