1

Hi I'm not able to see a caret sign on the text field. Even though I can type in it, not having cursor is misleading.

I've tried this on API15 to API19

The textfield is like this:

        <EditText
            android:id="@+id/login"
            style="@style/LoginEditText"
            android:completionThreshold="1"
            android:imeOptions="actionNext"
            android:inputType="textEmailAddress"
            android:nextFocusDown="@+id/pwd"
            />

<style name="LoginEditText" parent="EditText">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:autoText">false</item>
    <item name="android:capitalize">none</item>
    <item name="android:scrollHorizontally">true</item>
    <item name="android:singleLine">true</item>
    <item name="android:textSize">20sp</item>
</style>

<style name="EditText" parent="Global">
    <item name="android:textColor">@color/text</item>
    <item name="android:textSize">14sp</item>
    <item name="android:padding">10dp</item>
    <item name="android:layout_margin">10dp</item>
</style>
<style name="Global">
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_width">wrap_content</item>
</style>
<color name="text">#ff000000</color>

Settings in my theme

<style name="App_EditTextStyle" parent="@android:style/Widget.EditText">
    <item name="android:textColor">#808080</item>
    <item name="android:layout_height">45dip</item>
    <item name="android:background">#FFFFFF</item>
</style>

I want the background of the edittextfield to be white. So maybe the cursor is being white as well...I'm not sure.

If I remove <item name="android:background">#FFFFFF</item> then I do see the cursor, however, the background is no longer white as I wanted it to be white.

birdy
  • 9,286
  • 24
  • 107
  • 171

1 Answers1

0

Use android:textCursorDrawable="@null" and android:textColor

Do it like this

<?xml version="1.0" encoding="utf-8"?>
   <EditText xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="This is a template"
    android:background="#ffffff"
    android:textColor="#000000"
    android:cursorVisible="true"
    android:textCursorDrawable="@null" />
Lal
  • 14,726
  • 4
  • 45
  • 70