android - EditText 光标在 Android 5.0 (Lollipop) 上不可见

标签 android android-edittext cursor

EditText 光标在 Android 4.0 或更低版本上可见,但在 Android 5.0 (Lollipop) 版本中不显示。我该如何解决这个问题?

最佳答案

在您的 XML 文件中添加 android:cursorVisible="true"android:focusableInTouchMode="true"

例子:

<EditText 
    android:id="@+id/textLabel"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:cursorVisible="true" 
    android:focusableInTouchMode="true"/>

有时 EditText 需要焦点才能显示光标,所以也许它会对您有所帮助。

关于android - EditText 光标在 Android 5.0 (Lollipop) 上不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30374490/

相关文章:

android - 在Android文本框中打印经度和纬度

android - 如何将页面行添加到 Android 中的 EditText?

Android EditText 不打开键盘

oracle - oracle中内游标如何使用外游标的字段?

sql-server-2008 - 在 SQL Server 2008 中使用游标有哪些替代方法?

android - Jetpack Compose 和 Room DB : Performance overhead of auto-saving user input?

java - 安卓,群 : how to download multiple leaderboards on the same thread?

Android 打开外部存储目录(sdcard) 用于存储文件

android - 无法在 TextInputLayout 内的 EditText 中使用可绘制对象

html - 文本框中的光标位于中间而不是顶部