本文整理汇总了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();
}
}
示例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();
}
示例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);
}
示例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(); // 设置输入监听
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}