当前位置: 首页>>代码示例>>Java>>正文


Java EditText.setCursorVisible方法代码示例

本文整理汇总了Java中android.widget.EditText.setCursorVisible方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.setCursorVisible方法的具体用法?Java EditText.setCursorVisible怎么用?Java EditText.setCursorVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.EditText的用法示例。


在下文中一共展示了EditText.setCursorVisible方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setEditable

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * Input frame character length limit
 *
 * @param mEdit     EditText
 * @param maxLength maxLength
 */
public void setEditable(EditText mEdit, int maxLength) {
    if (mEdit.getText().length() < maxLength) {
        mEdit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength) {
        }});
        mEdit.setCursorVisible(true);
        mEdit.setFocusableInTouchMode(true);
        mEdit.requestFocus();
    } else {
        mEdit.setFilters(new InputFilter[]{new InputFilter() {
            @Override
            public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
                return source.length() < 1 ? dest.subSequence(dstart, dend) : "";
            }
        }});
        mEdit.setCursorVisible(false);
        mEdit.setFocusableInTouchMode(false);
        mEdit.clearFocus();
    }
}
 
开发者ID:Jusenr,项目名称:androidtools,代码行数:26,代码来源:StringUtils.java

示例2: SecurityCodeView

import android.widget.EditText; //导入方法依赖的package包/类
public SecurityCodeView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    TextViews = new TextView[6];
    View.inflate(context, R.layout.view_security_code, this);

    editText = (EditText) findViewById(R.id.item_edittext);
    TextViews[0] = (TextView) findViewById(R.id.item_code_iv1);
    TextViews[1] = (TextView) findViewById(R.id.item_code_iv2);
    TextViews[2] = (TextView) findViewById(R.id.item_code_iv3);
    TextViews[3] = (TextView) findViewById(R.id.item_code_iv4);
    TextViews[4] = (TextView) findViewById(R.id.item_code_iv5);
    TextViews[5] = (TextView) findViewById(R.id.item_code_iv6);

    editText.setCursorVisible(false);//将光标隐藏
    setListener();
}
 
开发者ID:android-jian,项目名称:topnews,代码行数:17,代码来源:SecurityCodeView.java

示例3: generateOneEditText

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * Takes care of styling the editText passed in the param.
 * tag is the index of the editText.
 *
 * @param styleEditText
 * @param tag
 */
private void generateOneEditText(EditText styleEditText, String tag) {
    params.setMargins(mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2, mSplitWidth / 2);
    filters[0] = new InputFilter.LengthFilter(1);
    styleEditText.setFilters(filters);
    styleEditText.setLayoutParams(params);
    styleEditText.setGravity(Gravity.CENTER);
    styleEditText.setCursorVisible(mCursorVisible);

    if (!mCursorVisible) {
        styleEditText.setClickable(false);
        styleEditText.setHint(mHint);

        styleEditText.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {
                // When back space is pressed it goes to delete mode and when u click on an edit Text it should get out of the delete mode
                mDelPressed = false;
                return false;
            }
        });
    }
    styleEditText.setBackgroundResource(mPinBackground);
    styleEditText.setPadding(0, 0, 0, 0);
    styleEditText.setTag(tag);
    styleEditText.setInputType(getKeyboardInputType());
    styleEditText.addTextChangedListener(this);
    styleEditText.setOnFocusChangeListener(this);
    styleEditText.setOnKeyListener(this);
}
 
开发者ID:GoodieBag,项目名称:Pinview,代码行数:37,代码来源:Pinview.java

示例4: SecurityView

import android.widget.EditText; //导入方法依赖的package包/类
public SecurityView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    View.inflate(context, R.layout.view_security_code, this);
    TextViews = new TextView[4];
    editText = (EditText) findViewById(R.id.item_edittext);
    TextViews[0] = (TextView) findViewById(R.id.item_code_iv1);
    TextViews[1] = (TextView) findViewById(R.id.item_code_iv2);
    TextViews[2] = (TextView) findViewById(R.id.item_code_iv3);
    TextViews[3] = (TextView) findViewById(R.id.item_code_iv4);

    editText.setCursorVisible(false);//将光标隐藏
    setListener(); // 设置输入监听
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:14,代码来源:SecurityView.java

示例5: init

import android.widget.EditText; //导入方法依赖的package包/类
private void init(AttributeSet attrs)
{
    TypedArray t = context.obtainStyledAttributes(attrs, R.styleable.NewAuthEditText);

    textSize = t.getDimensionPixelSize(R.styleable.NewAuthEditText_textSize, 18);
    textColor = t.getColor(R.styleable.NewAuthEditText_textColor, 0xff888888);

    frameColor = t.getColor(R.styleable.NewAuthEditText_frameColor, Colors.BLACK);

    frameWidth = t.getDimensionPixelOffset(R.styleable.NewAuthEditText_frameWidth, 1);

    textViewList = new ArrayList<>(maxLength);

    passwordString = t.getString(R.styleable.NewAuthEditText_passwordString);
    setPasswordString(null);

    et = new EditText(context);
    et.setBackgroundDrawable(null);
    et.setCursorVisible(false);
    et.setTextColor(Colors.TRANSPARENT);
    addDefaultTextChangeListener();

    inputType = InputType.valueOf(t.getInt(R.styleable.NewAuthEditText_inputType, 0));
    setInputType(inputType);

    llTvContent = new LinearLayout(context);
    addView(et, MATCH_PARENT, MATCH_PARENT);
    addView(llTvContent, MATCH_PARENT, MATCH_PARENT);

    int maxLength = t.getInt(R.styleable.NewAuthEditText_maxLength, 6);
    //初始化时,需要做限制
    if(maxLength < MIN_LENGTH || maxLength > MAX_LENGTH)
    {
        maxLength = DEFAULT_MAX_LENGTH;
    }
    setMaxLength(maxLength);

    t.recycle();
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:40,代码来源:NewAuthEditText.java

示例6: initEditText

import android.widget.EditText; //导入方法依赖的package包/类
/**
 * 初始化 {@link #etInput}
 */
private void initEditText()
{
    etInput = new EditText(context);
    etInput.setCursorVisible(false);
    etInput.setBackgroundDrawable(null);
    etInput.setTextColor(Colors.TRANSPARENT);
    setEditTextLength(textLength);

    addDefaultTextChangeListener();
}
 
开发者ID:Ayvytr,项目名称:EasyAndroid,代码行数:14,代码来源:AuthEditText.java

示例7: disableEditText

import android.widget.EditText; //导入方法依赖的package包/类
public void disableEditText(EditText editText) {
    editText.setFocusable(false);
    editText.setOnClickListener(this);
    editText.setCursorVisible(false);
    editText.setBackgroundColor(Color.TRANSPARENT);
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:7,代码来源:TaskDetailScroll.java

示例8: enableEditText

import android.widget.EditText; //导入方法依赖的package包/类
public void enableEditText(EditText editText) {
    editText.setCursorVisible(true);
    editText.setFocusableInTouchMode(true);
    menu.findItem(R.id.action_save).setVisible(true);
}
 
开发者ID:odoo-mobile-intern,项目名称:odoo-work,代码行数:6,代码来源:TaskDetailScroll.java


注:本文中的android.widget.EditText.setCursorVisible方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。