This issue is due to the choice of adding gravity to center the text. There is a known bug in the SDK that, as of 2.3, it looks like is still not fixed. This bug hides the hint text when
Source : stackoverflow.com
android:singleLine
and any custom value of android:gravity
are set together. Your choice at this juncture really is to remove one or the other. Some workaround options: - Remove the
android:gravity
declaration and have the text left-aligned. - Keep the declaration and remove android:singleLine. In this case, you will probably have to override the Editor Action in order to get the default Next or Done button on the soft keypad.
- replace parameter android:singleLine to android:maxLine
- Remove
android:gravity
, and setlayout_width="wrap_content"
. Then appropriately center the entire widget in the parent layout. This may look a little goofy with the standardEditText
background as it will grow and shrink. You may have to set this to null and make the background part of a parent container.
and leave the comments
Source : stackoverflow.com