Does anyone know how to disable the blinking cursor in an EditText
view?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Perfect Solution that goes further to the goal
Goal: Disable the blinking curser when
EditText
is not in focus, and enable the blinking curser whenEditText
is in focus. Below also opens keyboard whenEditText
is clicked, and hides it when you press done in the keyboard.1) Set in your xml under your
EditText
:2) Set onClickListener:
3) then
onCreate
, capture the event when done is pressed usingOnEditorActionListener
to yourEditText
, and thensetCursorVisible(false)
.In my case, I wanted to enable/disable the cursor when the edit is focused.
In your Activity:
You can use following code for enabling and disabling edit text cursor by programmatically.
You can use either the xml attribute
android:cursorVisible="false"
or the java functionsetCursorVisible(false)
.