2014-05-14 12 views
6

Hallo Ich versuche EditText zu multi line machen und erster Buchstabe sollte Typ sein wie in Kapital, das ich mit android:inputType="textCapSentences" tun, aber nach der Einstellung auf den Eingangstyp textCapSentences es zuerst gesetzt Brief in der Hauptstadt, aber EditText ist nur eine Zeile. Können Sie mir bitte helfen EditText Um auch mehrzeilige zu machen und erste Brief Typ Mehrzeilige Edit Text und Anfangsbuchstaben Großschreibung von Edit Text

Hier

in der Hauptstadt sollte es aktuell ist EditText

<EditText 
    android:id="@+id/commentsEditText" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="@dimen/view_vertical_margin" 
    android:background="@android:drawable/editbox_background" 
    android:inputType="textCapSentences" 
    android:gravity="top" 
    android:hint="@string/comments" 
    android:lines="5" /> 

Antwort

18

Haben Sie unten Code versuchen: -

<EditText 
    android:id="@+id/commentsEditText" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="@dimen/view_vertical_margin" 
    android:background="@android:drawable/editbox_background" 
    android:inputType="textCapSentences|textMultiLine" 
    android:gravity="top" 
    android:hint="@string/comments" 
    android:lines="5" /> 
+0

+1 ja es danken arbeitete Sie bitte können Sie es zu 'Android aktualisieren: input = "textCapSentences | textMultiLine"', so kann ich Ihre Antwort akzeptieren –

+0

aktualisiert @Williams danke, dass du mich berichtigt hast !!! – duggu

2

Versuchen Sie, set EditText eingabetyp wie folgt:

android:inputType="textCapSentences|textMultiLine" 
+0

+1 Vielen Dank Nice –

+1

Vielen Dank Haresh bhai !!! Sie haben meinen Tag gemacht !!! Sie sparen meinen Tag @@@ –

+0

@ Pratt, Froh, Ihnen zu helfen .... –

0
<EditText 
     android:id="@+id/commentsEditText" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="@dimen/view_vertical_margin" 
     android:background="@android:drawable/editbox_background" 
     android:inputType="textCapSentences" 
     android:gravity="top" 
     android:hint="@string/comments" 
     android:lines="5" 
     android:singleLine="false" /> 
0

Verwenden Sie edittext.setRawInputType (InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

und in xml android: input = "textMultiLine"