本文整理匯總了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);
}