-2

In below given image username hint never ever shown when I open this sign-in page, also tried to focus out. But that can not help me out. Please find this.

enter image description here

Here's my EditText code:

<EditText android:id="@+id/mobile_id_signin" 
    android:layout_width="match_parent" android:layout_height="45dp" 
    android:background="@drawable/edittext_shape_wight" 
    android:drawableLeft="@drawable/signin_username" 
    android:drawablePadding="15dp" android:gravity="left|center" 
    android:focusableInTouchMode="true" 
    android:descendantFocusability="beforeDescendants" 
    android:hint="UserName />
Shaishav
  • 5,282
  • 2
  • 22
  • 41
AndroidKing
  • 29
  • 1
  • 2
  • 7

2 Answers2

0

add this code in root layout because your activity gaining automatic focus on start

android:focusable="true" 
android:focusableInTouchMode="true"
Zeeshan Khan
  • 553
  • 7
  • 11
0

Use this code it is working and show proper hint.

<EditText android:id="@+id/mobile_id_signin"
    android:layout_width="match_parent" android:layout_height="45dp" android:drawablePadding="15dp"
    android:gravity="left|center" android:focusableInTouchMode="true"
    android:descendantFocusability="beforeDescendants" android:hint="@string/user_name" />
Pang
  • 9,564
  • 146
  • 81
  • 122
UJWAL GHONGADE
  • 109
  • 1
  • 9