Reputation: 13
My edit text shows hint but it does not show the cursor and the area for typing.what should i do so that it shows the cursor and the area and not just the hint?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main_menu"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@drawable/numberborder"
tools:context="com.example.light.primenumbercompanion.MainMenu">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/checker"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/black"
android:textStyle="bold"
android:layout_marginTop="37dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="37dp"
android:text="@string/checker"
android:textSize="20sp"/>
<TextView
android:id="@+id/checkerQeustion"
android:layout_below="@id/checker"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textStyle="bold"
android:layout_marginLeft="20dp"
android:layout_marginBottom="5dp"
android:text="@string/checkerQuestion"/>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginBottom="5dp"
android:id="@+id/checkerInput"
android:layout_below="@id/checkerQeustion"
android:hint="@string/checkerInput"
android:inputType="number"/>
</RelativeLayout>
i feel like the user will not know where to input the number
Upvotes: 1
Views: 88
Reputation: 2604
If you want to change the colour of the cursor in your EditText you can add the below line in your EditText tag in XML
android:textCursorDrawable="@drawable/cursor_color"
cursor_color.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<size android:width="3dp" />
<solid android:color="#000000" />
</shape>
My default colour is black you can change the colour whatever you want. Try it an let me know if it worked for you.
Upvotes: 0
Reputation: 284
There is no problem in your activity copy my code i've run your code it works fine although you were not closing scroll view close it first or maybe u forget to send code of closing scroll view and send your java so i'd verify it so there is no problem.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main_menu"
android:layout_width="match_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/checker"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginTop="37dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="37dp"
android:text="Heading text"
android:textSize="20sp"/>
<TextView
android:id="@+id/checkerQeustion"
android:layout_below="@id/checker"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textStyle="bold"
android:layout_marginLeft="20dp"
android:layout_marginBottom="5dp"
android:text="textview"/>
<EditText
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginBottom="5dp"
android:id="@+id/checkerInput"
android:layout_below="@id/checkerQeustion"
android:hint="testedittext"
android:inputType="number"/>
</RelativeLayout>
</ScrollView>
Upvotes: 1