解决EditText不显示光标的三种方法(总结)
作者:jingxian 时间:2023-09-19 08:05:10
解决方法有以下3种
1、在Edittext中加入以下属性
android:cursorVisible="true"
android:textCursorDrawable="@null"
2、在Edittext中加入以下属性
android:cursorVisible="true"
android:textCursorDrawable="@drawable/test_cursor"
对应的drawable文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:width="1dp" />
<span style="font-family: Arial, Helvetica, sans-serif;">
<!-- 光标宽度可以自己定义 --></span>
<solid android:color="#008000" />
<!-- 光标颜色可以自己定义 -->
</shape>
3、如果以上没有效果就请用这个
明确指定EditText的inputType属性值inputType属性中的textCapSentences
不要用这个,国内手机好像没有用到这个,个人证实而已,用text或者textMultiLine
android:inputType="text|textMultiLine"
标签:edittext,光标,不显示
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
一个依赖搞定 Spring Boot 接口防盗刷的流程分析
2023-06-01 16:46:41
![](https://img.aspxhome.com/file/2023/4/93344_0s.png)
结合mybatis-plus实现简单不需要写sql的多表查询
2021-06-25 12:54:22
C#中String和StringBuilder的简介与区别
2021-10-13 06:40:54
EL表达式的隐式对象_动力节点Java学院整理
2022-10-13 06:04:01
![](https://img.aspxhome.com/file/2023/9/86849_0s.jpg)
c#获取相同概率随机数的算法代码
2022-09-07 21:18:13
清除aspx页面缓存的程序实现方法
2021-10-28 06:16:57
在Visual Studio上构建C++的GUI框架wxWidgets的开发环境
2023-04-12 01:02:06
![](https://img.aspxhome.com/file/2023/2/139452_0s.png)
Spring Cloud Alibaba使用Nacos作为注册中心和配置中心
2021-07-15 18:18:42
![](https://img.aspxhome.com/file/2023/3/67983_0s.png)
C#使用log4net记录日志的方法步骤
2021-07-07 18:14:55
![](https://img.aspxhome.com/file/2023/9/106449_0s.png)
Android 显示GIF图片实例详解
2023-08-06 09:11:52
![](https://img.aspxhome.com/file/2023/8/86758_0s.jpg)
Java中两个字符串进行大小比较的方法
2023-10-12 13:39:26
.net实现序列化与反序列化实例解析
2022-08-05 06:42:08
通过Java修改游戏存档的实现思路
2023-07-30 20:10:55
![](https://img.aspxhome.com/file/2023/7/75517_0s.jpg)
Springboot日志开启SLF4J过程解析
2022-04-23 01:29:57
Android实现屏幕锁定源码详解
2022-10-08 00:46:38
![](https://img.aspxhome.com/file/2023/1/123251_0s.png)
Spring Cloud Alibaba Nacos 入门详解
2022-02-23 12:29:09
![](https://img.aspxhome.com/file/2023/0/116810_0s.jpg)
Android实现图片点击放大
2023-03-19 17:40:59
Spring核心IoC容器的依赖注入接口和层级包命名规范
2021-12-31 02:22:57
![](https://img.aspxhome.com/file/2023/6/109946_0s.jpg)
Android 仿QQ头像自定义截取功能
2023-05-14 00:13:21
![](https://img.aspxhome.com/file/2023/9/128979_0s.gif)
Android模仿知乎的回答详情页的动画效果
2022-12-25 06:08:57
![](https://img.aspxhome.com/file/2023/6/139546_0s.gif)