I have an edit-text input in android 4.0 and the Cursor is not showing inside it.
What can make the cursor not appear in the input field?
I have an edit-text input in android 4.0 and the Cursor is not showing inside it.
What can make the cursor not appear in the input field?
Just adding my own personal fix to anyone it might help. I had tried everything here but forcing
android:background="@null"
was causing a very tiny cursor only at the end of my right alignedTextEdit
(it was right working fine elsewhere).Simply adding
android:padding="1dp"
in myTextEdit
solved the issue.My issue was that I was using the AppCompat theme, but I had some custom view classes that extended EditText that needed to extend AppCompatEditText in order for the AppCompat style to be applied correctly.
As mentioned above, here's the actual line
android:textCursorDrawable="@null"
I found what was causing it to happen to me.
You need to inherit it from the application's theme. I'm not sure what the line item needs to be exactly, but
android:Theme
has it so inheriting that will do that trick.Using the default
AppBaseTheme
will work (it hasandroid:Theme.Light
as it's parent).To use
AppBaseTheme
putandroid:theme="@style/AppBaseTheme"
into your application tag in the manifest. You can also use a custom style and multiple levels of inheritance so long as one of them hasparent="android:Theme"
in the style tag.Like I said it may be possible to have it without that, just using certain line item(s) but I don't know what those would be.If you don't need a custom theme you can just use
android:theme="@android:style/Theme"
Add this line for your edit text in the xml file.
In My case the cursor is visible if user language is English but if he change his language to Arabic then its not visible.
To fix this I have created on custom drawable for cursor.
Cursur shap at drawable/black_cursor.xml
Edit Text: