Hint in Android

2019-05-10 08:24发布

问题:

I tried to show a hint in the EditText of my form, but i can't see that hint that i have set in the XML Layout while my application gets deployed, but i can able see the hint in eclipse designer view, but while getting deployed the same hint suppose to appear is missing, i tried with all the possible ways still i could not get the hint in the EditText... This is one of the Edit Text layout that i have used..

<EditText android:id="@+id/SetTimerSec_EditText01"
    android:layout_width="60sp" 
    android:layout_height="40sp"
    android:singleLine="true" 
    android:layout_x="220sp" 
    android:layout_y="170sp"
    android:hint="0"
    android:inputType="phone"
    android:textColorHint="@color/black"
    android:gravity="center"
    android:focusableInTouchMode="true" />

[link text][1]

Can anybody Help me..Please

Thanks in advance

[1]: http://imgur.com/PzomF.jpg [ScreenShot of Designer View with hint displayed][1]

回答1:

It seems like a SDK bug, or at least related to one.
http://code.google.com/p/android/issues/detail?id=7252

The hint shows up if you remove the following:
android:gravity="center"



回答2:

add android:ellipsize="start" and your hint will show up and be centered!