2014-03-27 3 views

답변

3

당신은 당신의 XML에

android:ellipsize="end" 
android:gravity="center" 

를 사용할 수 있습니다. 예 :

<EditText 
    android:id="@+id/txt1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:ellipsize="end" 
    android:gravity="center" 
    android:hint="@string/your_hint_id" 
/> 
+0

나를 위해 작동하지 않았습니다. 이건 내 글고 코드 : <글고 안드로이드 : ID = "@ + ID/이름" 안드로이드 : layout_width = "wrap_content는" 안드로이드 : layout_height = "wrap_content" 안드로이드 : ellipsize는 = 안드로이드 "종료"중력 = " 센터 " 안드로이드 : 힌트 ="@ 문자열/register_name_hint " 안드로이드 : 대해서는 imeOptions ="flagNoExtractUi | actionDone " 안드로이드 : textCursorDrawable ="@ 널 (null) "> 내가 함께 두 가지 옵션을 테스트하지 않았습니다 – KinGPinG

+0

. 첫번째와 다른 것을 사용해보십시오. 힌트를 위해 나는 android : gravity = "center"가 작동 할 것이라고 확신한다. 아마 그들은 함께 작동하지 않습니다 ... – gior91

1

이 더 나은 해결책이 될 수 있어야하고 나를 위해 일했다.

<EditText 
android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:text="1234" 
android:layout_weight="1" 
android:id="@+id/editText1" 
android:gravity="center_horizontal"></EditText> 
+1

@Lal, 편집 해 주셔서 감사합니다. –

관련 문제