shuttle1978
shuttle1978

Reputation: 123

android edittext wrap text

This is my Edittext layout

<EditText
        android:id="@+id/txt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="0dp"
        android:layout_marginRight="0dp"
        android:gravity="center"
        android:inputType="text|textFilter|textNoSuggestions"
        android:padding="0dp"
        android:singleLine="true"
        android:textSize="15dp" android:text="S"
        android:visibility="visible" >
    </EditText>

If I try to put textSize="30dp", for example, the edittext is not resized and the letter is trouncated. Where is the problem?

Upvotes: 0

Views: 5650

Answers (2)

M Karimi
M Karimi

Reputation: 3593

add below code to editText tag for wrap editText:

android:layout_height="wrap_content"
android:inputType="text|textMultiLine"

Upvotes: 0

Omar HossamEldin
Omar HossamEldin

Reputation: 3111

Removing the android:inputType attribute from your Edittext will solve your problem. I don't what is the relation between this attribute and wrapping the text. but i faced this problem too.

Update: Add textMultiLine to your android:inputType attribute.

Source https://stackoverflow.com/a/3286921/2294985

Upvotes: 4

Related Questions