黄圣依乳晕,修真神偷2,acmetea官网
在editext的布局属性上加上
android:textcursordrawable="@drawable/cursor_shape"
cursor_shape如下:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <size android:width="1dp" /> <solid android:color="@color/comics_theme_color" /> <padding android:top="-2dp" android:bottom="-2dp"/> </shape>
事实证明:设置android:height无效,应该用padding的方法。
top设置为-2dp :让光标顶部下移2dp
bottom设置为-2dp:让光标底部上移2dp
这样子光标的高度就变小了4dp
从下面的源码可以大概看出原因:
private void updatecursorposition(int cursorindex, int top, int bottom, float horizontal) { ... mcursordrawable[cursorindex].getpadding(mtemprect); ... mcursordrawable[cursorindex].setbounds(left, top - mtemprect.top, left + width, bottom + mtemprect.bottom); }
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android apk 项目一键打包并上传到蒲公英的实现方法
Android 自定义LineLayout实现满屏任意拖动功能的示例代码
android 限制某个操作每天只能操作指定的次数(示例代码详解)
Android 集成 google 登录并获取性别等隐私信息的实现代码
网友评论