Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi line Edit Text and first letter capitalization of Edit Text

Hello I am trying to make EditText to multi line and first letter should be type as in capital which I am doing using android:inputType="textCapSentences" but after setting to input type to textCapSentences it set first letter in capital but EditText is single line only. Can you please help me to make EditText to multiline plus first letter should be type in capital

Here it is current 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" />
like image 928
N Sharma Avatar asked May 14 '14 09:05

N Sharma


People also ask

Which allows editing of multiple lines of text?

Just add this android:inputType="textMultiLine" in XML file on relevant field. Save this answer.

How do I stop deleting the first character of edit text android?

So you can simply take the text and append the text with "/" as first character. You get what you want. Text with first character "/". This might be of some help: [Put a constant text inside EditText which should be non-editable][1] [1]: stackoverflow.com/questions/14195207/…

How can the user set caps to the text while reading input in android Studio?

You can add the android:textAllCaps="true" property to your xml file in the EditText. This will enforce the softinput keyboard to appear in all caps mode.


1 Answers

Have you try below code :-

<EditText
    android:id="@+id/commentsEditText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:drawable/editbox_background"
    android:inputType="textCapSentences|textMultiLine"
    android:gravity="top"
    android:hint="@string/comments"
    android:lines="5" />
like image 176
duggu Avatar answered Nov 10 '22 01:11

duggu