I want to change the EditText
cursor height, does anyone know how?
相关问题
- 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
I had to dig far into the Android source to find the answer to this, but you essentially have to use padding on a custom shape drawable.
note: only works on API 12 and greater due to support for
textCursorDrawable
Use positive top padding to move the top of your cursor higher
User positive bottom padding to move the bottom of your cursor lower
I usually end up using negative bottom padding to shorten the cursor because the it drops too low below baseline when you increase the line height with
lineSpacingMultiplier
orlineSpacingExtra
.example cursor_red.xml:
This will make a 2dip wide red cursor that is
Then in your edittext, just specify
android:textCursorDrawable
:Relevant Android source code inside Editor.java from which I figured out the solution:
change the editText style to a custom style
then use a drawable to set the cursor: