Java Code Examples for android.widget.EditText#setCursorVisible()
The following examples show how to use
android.widget.EditText#setCursorVisible() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SoftKeyboard.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
private void initEditTexts(ViewGroup viewgroup) { if (editTextList == null) editTextList = new ArrayList<EditText>(); int childCount = viewgroup.getChildCount(); for (int i = 0; i <= childCount - 1; i++) { View v = viewgroup.getChildAt(i); if (v instanceof ViewGroup) { initEditTexts((ViewGroup) v); } if (v instanceof EditText) { EditText editText = (EditText) v; editText.setOnFocusChangeListener(this); editText.setCursorVisible(true); editTextList.add(editText); } } }
Example 2
Source File: HyperTextEditor.java From YCCustomText with Apache License 2.0 | 6 votes |
/** * 添加生成文本输入框 * @param hint 内容 * @param paddingTop 到顶部高度 * @return */ private EditText createEditText(String hint, int paddingTop) { EditText editText = new DeletableEditText(getContext()); LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); editText.setLayoutParams(layoutParams); editText.setTextSize(16); editText.setTextColor(Color.parseColor("#616161")); editText.setCursorVisible(true); editText.setBackground(null); editText.setOnKeyListener(keyListener); editText.setOnFocusChangeListener(focusListener); editText.addTextChangedListener(textWatcher); editText.setTag(viewTagIndex++); editText.setPadding(editNormalPadding, paddingTop, editNormalPadding, paddingTop); editText.setHint(hint); editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, rtTextSize); editText.setTextColor(rtTextColor); editText.setHintTextColor(rtHintTextColor); editText.setLineSpacing(rtTextLineSpace, 1.0f); HyperLibUtils.setCursorDrawableColor(editText, cursorColor); return editText; }
Example 3
Source File: SoftKeyboard.java From talk-android with MIT License | 6 votes |
private void initEditTexts(ViewGroup viewgroup) { if (editTextList == null) editTextList = new ArrayList<EditText>(); int childCount = viewgroup.getChildCount(); for (int i = 0; i <= childCount - 1; i++) { View v = viewgroup.getChildAt(i); if (v instanceof ViewGroup) { initEditTexts((ViewGroup) v); } if (v instanceof EditText) { EditText editText = (EditText) v; editText.setOnFocusChangeListener(this); editText.setCursorVisible(false); editTextList.add(editText); } } }
Example 4
Source File: DialpadView.java From call_manage with MIT License | 5 votes |
/** * Whether or not the digits above the dialer can be edited. * * @param canBeEdited If true, the backspace button will be shown and the digits EditText * will be configured to allow text manipulation. */ public void setDigitsCanBeEdited(boolean canBeEdited) { View deleteButton = findViewById(R.id.button_delete); deleteButton.setVisibility(canBeEdited ? View.VISIBLE : View.GONE); View callButton = findViewById(R.id.button_call); callButton.setVisibility(canBeEdited ? View.VISIBLE : View.GONE); EditText digits = (DigitsEditText) findViewById(R.id.digits_edit_text); digits.setClickable(canBeEdited); digits.setLongClickable(canBeEdited); digits.setFocusableInTouchMode(canBeEdited); digits.setCursorVisible(canBeEdited); }
Example 5
Source File: Pinview.java From Pinview with MIT License | 5 votes |
/** * 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); }
Example 6
Source File: Pinview.java From Pinview with MIT License | 5 votes |
public void showCursor(boolean status) { mCursorVisible = status; if (editTextList == null || editTextList.isEmpty()) { return; } for (EditText edt : editTextList) { edt.setCursorVisible(status); } }
Example 7
Source File: PayEditView.java From Android with MIT License | 5 votes |
public PayEditView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); imageViews = new ImageView[4]; View view = View.inflate(context, R.layout.item_pay_edit, this); editText = (EditText) findViewById(R.id.item_edittext); imageViews[0] = (ImageView) findViewById(R.id.item_password_iv1); imageViews[1] = (ImageView) findViewById(R.id.item_password_iv2); imageViews[2] = (ImageView) findViewById(R.id.item_password_iv3); imageViews[3] = (ImageView) findViewById(R.id.item_password_iv4); editText.setCursorVisible(false); setListener(); }
Example 8
Source File: MainActivity.java From AndroidDemo with MIT License | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);//禁止软键盘打开界面时自动跳出 btnCreate = (Button) findViewById(R.id.db_create);//xml定义的控件与程序定义的变量绑定 btnInit = (Button) findViewById(R.id.db_init); btnList = (Button) findViewById(R.id.db_list); btnInsert = (Button) findViewById(R.id.db_insert); btnDelete = (Button) findViewById(R.id.db_delete); btnUpdate = (Button) findViewById(R.id.db_update); btnQuery = (Button) findViewById(R.id.db_query); editTextName = (EditText) findViewById(R.id.stu_name); editTextID = (EditText) findViewById(R.id.stu_no); editTextAge = (EditText) findViewById(R.id.stu_age); editTextID.setCursorVisible(false);//取消编辑控件闪烁效果 editTextAge.setCursorVisible(false); editTextName.setCursorVisible(false); btnCreate.setOnClickListener(lisenter);//设置按钮的侦听器 btnInit.setOnClickListener(lisenter); btnList.setOnClickListener(lisenter); btnInsert.setOnClickListener(lisenter); btnDelete.setOnClickListener(lisenter); btnUpdate.setOnClickListener(lisenter); btnQuery.setOnClickListener(lisenter); }
Example 9
Source File: T9TelephoneDialpadView.java From PinyinSearchLibrary with Apache License 2.0 | 5 votes |
private void initView() { LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); mDialpadView = inflater.inflate(R.layout.t9_telephone_dialpad_layout, this); mTelephoneDialCloseBtn = (Button) mDialpadView .findViewById(R.id.telephone_dial_close_btn); mDialDeleteBtn = (Button) mDialpadView .findViewById(R.id.dial_delete_btn); mT9InputEt = (EditText) mDialpadView .findViewById(R.id.dial_input_edit_text); mT9InputEt.setCursorVisible(false); }
Example 10
Source File: T9TelephoneDialpadView.java From PinyinSearchLibrary with Apache License 2.0 | 5 votes |
private void initView() { LayoutInflater inflater = (LayoutInflater) mContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE); mDialpadView = inflater.inflate(R.layout.t9_telephone_dialpad_layout, this); mTelephoneDialCloseBtn = (Button) mDialpadView .findViewById(R.id.telephone_dial_close_btn); mDialDeleteBtn = (Button) mDialpadView .findViewById(R.id.dial_delete_btn); mT9InputEt = (EditText) mDialpadView .findViewById(R.id.dial_input_edit_text); mT9InputEt.setCursorVisible(false); }
Example 11
Source File: PinEntryWrapper.java From Conversations with GNU General Public License v3.0 | 5 votes |
public void setEnabled(final boolean enabled) { for (EditText digit : digits) { digit.setEnabled(enabled); digit.setCursorVisible(enabled); digit.setFocusable(enabled); digit.setFocusableInTouchMode(enabled); } if (enabled) { final EditText last = digits.get(digits.size() - 1); if (last.getEditableText().length() > 0) { last.requestFocus(); } } }
Example 12
Source File: DialerActivity.java From emerald-dialer with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); DialerApp.setTheme(this); setContentView(R.layout.main); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); if (!preferences.getBoolean("privacy_policy", false)) { showPrivacyPolicyDialog(preferences.edit()); } if (Build.VERSION.SDK_INT >= 23 && !hasRequiredPermissions()) { requestPermissions(PERMISSIONS, 0); for (int i = 0; i < 5; i++) { if (checkSelfPermission(PERMISSIONS[i]) == PackageManager.PERMISSION_GRANTED) { continue; } else { finish(); } } } numberField = (EditText)findViewById(R.id.number_field); parseIntent(getIntent()); telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); setButtonListeners(); numberField.setCursorVisible(false); numberField.requestFocus(); numberField.addTextChangedListener(this); list = (ListView) findViewById(R.id.log_entries_list); onCallLogScrollListener = new OnCallLogScrollListener(this); list.setOnScrollListener(onCallLogScrollListener); TypedValue outValue = new TypedValue(); getTheme().resolveAttribute(R.attr.drawableContactImage, outValue, true); int defaultContactImageId = outValue.resourceId; mAsyncContactImageLoader = new AsyncContactImageLoader(this, getResources().getDrawable(defaultContactImageId, getTheme())); logEntryAdapter = new LogEntryAdapter(this, null, mAsyncContactImageLoader); list.setAdapter(logEntryAdapter); list.setOnItemClickListener(this); list.setOnItemLongClickListener(this); String t9Locale = preferences.getString("t9_locale", "system"); Context t9LocaleContext = null; if (!t9Locale.equals("system")) { Configuration t9Configuration = getResources().getConfiguration(); t9Configuration.setLocale(new Locale(t9Locale, t9Locale)); t9LocaleContext = createConfigurationContext(t9Configuration); Resources t9Resources = t9LocaleContext.getResources(); // For numpad buttons (2...9) int[] numpadLettersIds = new int[] { R.string.numpad_2, R.string.numpad_3, R.string.numpad_4, R.string.numpad_5, R.string.numpad_6, R.string.numpad_7, R.string.numpad_8, R.string.numpad_9 }; for (int i = 2; i <= 9; i++) { ((NumpadButton)(findViewById(buttonIds[i]))) .setLetters(t9Resources.getString(numpadLettersIds[i-2])); } } contactsEntryAdapter = new ContactsEntryAdapter(this, mAsyncContactImageLoader, t9LocaleContext); int keyboardType = getResources().getConfiguration().keyboard; if (keyboardType == Configuration.KEYBOARD_QWERTY) { numberField.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS); contactsEntryAdapter.setRawFiltering(true); findViewById(R.id.btn_toggle_numpad).setVisibility(View.INVISIBLE); findViewById(R.id.numpad).setVisibility(View.GONE); } else if (keyboardType == Configuration.KEYBOARD_12KEY) { findViewById(R.id.btn_toggle_numpad).setVisibility(View.INVISIBLE); findViewById(R.id.numpad).setVisibility(View.GONE); } getLoaderManager().initLoader(0, null, this); getLoaderManager().initLoader(1, null, this); getLoaderManager().getLoader(0).forceLoad(); getLoaderManager().getLoader(1).forceLoad(); }