Android Edittext cursor invisible

I have an edittext application in my application that will correctly show the cursor in Froyo or Gingerbread, however in the future the sdks cursor is invisible. I found an online solution to set android: textCursorDrawable = "@null" so that edittext uses the font color for the cursor. However, since my minsdkversion is 8, I do not have access to this property.

Is this either a way to selectively add the sdk-based property you're on? Or perhaps a way around this so that I can see visible cursors for both old and new sdk versions?

+6
source share
3 answers

I don't know your current setting, but one way to use this property is to use different layout folders based on different versions of Android. android:textCursorDrawable is a property introduced in API 12, so you may have a layout folder of type layout-v12 that will be used where the API is 12 or more. The layouts in this folder use the property. For lower versions of Froyo and Gingerbread , you have no problem, so you should use the default layout folder. As a result, you will have two layout folders (containing the same layout files):

 layout // don't need the property layout-v12 // use the property 

This rules out API 11, I don’t know if this is a deal violation for you.

+3
source

Try setting the targetSdkVersion target value for API level 13 or higher to gain access to the android property: textCursorDrawable

0
source

If you don't have a cursor, I assume the input is simple and says you can enter new characters at the end of the text?

I think you can use TextView and add this KeyListener ? But in this case, you will have a problem with the virtual keyboard, and not with the display, see Some of these links:

Disable soft keyboard

android power keyboard is visible

or create your own keyboard if the title of the correct keys is very limited as soon as the numbers.

0
source

Source: https://habr.com/ru/post/924312/


All Articles