boring91
boring91

Reputation: 1121

Cannot get the EditText to have multiple lines

I'm trying to have multiple lines in EditText. I have tried many solutions to get this working but none of them seem to work. What I have right now is this:

<EditText
        android:id="@+id/uf_aboutme_box"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="top|start"
        android:hint="@string/tellusaboutyourself"
        android:inputType="textMultiLine"
        android:lines="8"
        android:maxLines="10"
        android:minLines="6"
        android:scrollbars="vertical"/>

Although, the above code renders correctly in the preview, when I test it on a real phone it becomes a single line! Can anybody tell me what's wrong with code above?

Edit:

The parent layout is:

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">

Edit 2:

This is my entire layout file:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/uf_firstname_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/firstnamewithstar"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>


        <TextView
            android:id="@+id/uf_lastname_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/lastnamewithstar"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <EditText
            android:id="@+id/uf_firstname_box"
            android:layout_width="0dp"
            android:layout_height="@dimen/editbox_height"
            android:layout_marginLeft="1dp"
            android:layout_marginStart="1dp"
            android:layout_weight="1"
            android:inputType="textPersonName"
            android:padding="5dp"/>

        <EditText
            android:id="@+id/uf_lastname_box"
            android:layout_width="0dp"
            android:layout_height="@dimen/editbox_height"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:inputType="textPersonName"
            android:padding="5dp"/>
    </LinearLayout>

    <!-- Email -->

    <TextView
        android:id="@+id/uf_email_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/emailwithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <EditText
        android:id="@+id/uf_email_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:hint="@string/emailhint"
        android:inputType="textEmailAddress"
        android:padding="5dp"/>

    <TextView
        android:id="@+id/uf_emailnote_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="2dp"
        android:text="@string/emailnote"
        android:textColor="@color/black_light"
        android:textSize="@dimen/font_small"/>

    <!-- Password -->

    <TextView
        android:id="@+id/uf_password_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/passwordwithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <EditText
        android:id="@+id/uf_password_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:inputType="textPassword"
        android:padding="5dp"/>

    <!-- Mobile phone -->

    <TextView
        android:id="@+id/uf_mobile_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/mobilewithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <Spinner
            android:id="@+id/uf_countriesforphone_spinner"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            />

        <EditText
            android:id="@+id/uf_phone_box"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="0.75"
            android:inputType="phone"
            android:padding="5dp"/>
    </LinearLayout>

    <!-- Current City -->

    <TextView
        android:id="@+id/uf_city_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/starredcity"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <Spinner
        android:id="@+id/uf_city_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:padding="5dp"/>


    <!-- Nationality -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/uf_nationality_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/nationality"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>

        <TextView
            android:id="@+id/uf_birthday_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:text="@string/dateofbirth"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <Spinner
            android:id="@+id/uf_countriesfornationality_spinner"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            />

        <TextView
            android:id="@+id/uf_birthday_box"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:drawableEnd="@drawable/ic_event_available_grey600_18dp"
            android:drawableRight="@drawable/ic_event_available_grey600_18dp"
            android:gravity="center_vertical"
            android:hint="@string/selectBrackets"
            android:padding="5dp"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <TextView
        android:id="@+id/uf_gender_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/gender"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <RadioGroup
        android:id="@+id/uf_gender_radiogroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/uf_male_radiobutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/male"/>

        <RadioButton
            android:id="@+id/uf_female_radiobutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/female"/>
    </RadioGroup>

    <!-- About me -->

    <TextView
        android:id="@+id/uf_aboutme_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/aboutme"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>


    <EditText
        android:id="@+id/uf_aboutme_box"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="top|start"
        android:hint="@string/tellusaboutyourself"
        android:inputType="textMultiLine"
        android:lines="8"
        android:maxLines="10"
        android:minLines="6"
        android:scrollbars="vertical"/>

</LinearLayout>

Upvotes: 2

Views: 674

Answers (6)

boring91
boring91

Reputation: 1121

I finally was able to resolve my issue by overriding the onViewCreated of the fragment and putting these line inside:

mAboutMeBox.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
mAboutMeBox.setSingleLine(false);
mAboutMeBox.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);

Upvotes: 0

Parvathy H Kumar
Parvathy H Kumar

Reputation: 86

This might work. Please check it out.

<EditText
android:inputType="textMultiLine" <!-- Multiline input -->
android:lines="8" <!-- Total Lines prior display -->
android:minLines="6" <!-- Minimum lines -->
android:gravity="top|left" <!-- Cursor Position -->
android:maxLines="10" <!-- Maximum Lines -->
android:layout_height="wrap_content" <!-- Height determined by content -->
android:layout_width="fill_parent" <!-- Fill entire width -->
android:scrollbars="vertical" <!-- Vertical Scroll Bar -->
/>

Upvotes: 0

Sachin Chandil
Sachin Chandil

Reputation: 17809

Put everything in ScrollView like following and you are good to go. Because LinearLayout does not support scrolling and it resized edittext according to the height left.

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/uf_firstname_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/firstnamewithstar"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>


        <TextView
            android:id="@+id/uf_lastname_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/lastnamewithstar"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <EditText
            android:id="@+id/uf_firstname_box"
            android:layout_width="0dp"
            android:layout_height="@dimen/editbox_height"
            android:layout_marginLeft="1dp"
            android:layout_marginStart="1dp"
            android:layout_weight="1"
            android:inputType="textPersonName"
            android:padding="5dp"/>

        <EditText
            android:id="@+id/uf_lastname_box"
            android:layout_width="0dp"
            android:layout_height="@dimen/editbox_height"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:inputType="textPersonName"
            android:padding="5dp"/>
    </LinearLayout>

    <!-- Email -->

    <TextView
        android:id="@+id/uf_email_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/emailwithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <EditText
        android:id="@+id/uf_email_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:hint="@string/emailhint"
        android:inputType="textEmailAddress"
        android:padding="5dp"/>

    <TextView
        android:id="@+id/uf_emailnote_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="2dp"
        android:text="@string/emailnote"
        android:textColor="@color/black_light"
        android:textSize="@dimen/font_small"/>

    <!-- Password -->

    <TextView
        android:id="@+id/uf_password_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/passwordwithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <EditText
        android:id="@+id/uf_password_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:inputType="textPassword"
        android:padding="5dp"/>

    <!-- Mobile phone -->

    <TextView
        android:id="@+id/uf_mobile_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/mobilewithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <Spinner
            android:id="@+id/uf_countriesforphone_spinner"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            />

        <EditText
            android:id="@+id/uf_phone_box"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="0.75"
            android:inputType="phone"
            android:padding="5dp"/>
    </LinearLayout>

    <!-- Current City -->

    <TextView
        android:id="@+id/uf_city_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/starredcity"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <Spinner
        android:id="@+id/uf_city_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:padding="5dp"/>


    <!-- Nationality -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/uf_nationality_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/nationality"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>

        <TextView
            android:id="@+id/uf_birthday_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:text="@string/dateofbirth"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <Spinner
            android:id="@+id/uf_countriesfornationality_spinner"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            />

        <TextView
            android:id="@+id/uf_birthday_box"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:drawableEnd="@drawable/ic_event_available_grey600_18dp"
            android:drawableRight="@drawable/ic_event_available_grey600_18dp"
            android:gravity="center_vertical"
            android:hint="@string/selectBrackets"
            android:padding="5dp"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <TextView
        android:id="@+id/uf_gender_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/gender"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <RadioGroup
        android:id="@+id/uf_gender_radiogroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/uf_male_radiobutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/male"/>

        <RadioButton
            android:id="@+id/uf_female_radiobutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/female"/>
    </RadioGroup>

    <!-- About me -->

    <TextView
        android:id="@+id/uf_aboutme_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/aboutme"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>


    <EditText
        android:id="@+id/uf_aboutme_box"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="top|start"
        android:hint="@string/tellusaboutyourself"
        android:inputType="textMultiLine"
        android:lines="8"
        android:maxLines="10"
        android:minLines="6"
        android:scrollbars="vertical"/>

</LinearLayout>


</ScrollView>

Upvotes: 0

Duc Nguyen
Duc Nguyen

Reputation: 87

I think parent view of edittext has been set weight, So parent view limit heigh of Edittext. You need re design your layout. Replace your code with:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">
  <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
 <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/uf_firstname_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/firstnamewithstar"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>


        <TextView
            android:id="@+id/uf_lastname_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/lastnamewithstar"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <EditText
            android:id="@+id/uf_firstname_box"
            android:layout_width="0dp"
            android:layout_height="@dimen/editbox_height"
            android:layout_marginLeft="1dp"
            android:layout_marginStart="1dp"
            android:layout_weight="1"
            android:inputType="textPersonName"
            android:padding="5dp"/>

        <EditText
            android:id="@+id/uf_lastname_box"
            android:layout_width="0dp"
            android:layout_height="@dimen/editbox_height"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:inputType="textPersonName"
            android:padding="5dp"/>
    </LinearLayout>

    <!-- Email -->

    <TextView
        android:id="@+id/uf_email_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/emailwithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <EditText
        android:id="@+id/uf_email_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:hint="@string/emailhint"
        android:inputType="textEmailAddress"
        android:padding="5dp"/>

    <TextView
        android:id="@+id/uf_emailnote_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="2dp"
        android:text="@string/emailnote"
        android:textColor="@color/black_light"
        android:textSize="@dimen/font_small"/>

    <!-- Password -->

    <TextView
        android:id="@+id/uf_password_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/passwordwithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <EditText
        android:id="@+id/uf_password_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:inputType="textPassword"
        android:padding="5dp"/>

    <!-- Mobile phone -->

    <TextView
        android:id="@+id/uf_mobile_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/mobilewithstar"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <Spinner
            android:id="@+id/uf_countriesforphone_spinner"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            />

        <EditText
            android:id="@+id/uf_phone_box"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="0.75"
            android:inputType="phone"
            android:padding="5dp"/>
    </LinearLayout>

    <!-- Current City -->

    <TextView
        android:id="@+id/uf_city_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/starredcity"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <Spinner
        android:id="@+id/uf_city_box"
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:padding="5dp"/>


    <!-- Nationality -->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/uf_nationality_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/nationality"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>

        <TextView
            android:id="@+id/uf_birthday_label"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:text="@string/dateofbirth"
            android:textColor="@color/orange_dark"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/editbox_height"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <Spinner
            android:id="@+id/uf_countriesfornationality_spinner"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            />

        <TextView
            android:id="@+id/uf_birthday_box"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginStart="2dp"
            android:layout_weight="1"
            android:drawableEnd="@drawable/ic_event_available_grey600_18dp"
            android:drawableRight="@drawable/ic_event_available_grey600_18dp"
            android:gravity="center_vertical"
            android:hint="@string/selectBrackets"
            android:padding="5dp"
            android:textSize="@dimen/font_normal"/>
    </LinearLayout>

    <TextView
        android:id="@+id/uf_gender_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/gender"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>

    <RadioGroup
        android:id="@+id/uf_gender_radiogroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:orientation="horizontal">

        <RadioButton
            android:id="@+id/uf_male_radiobutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/male"/>

        <RadioButton
            android:id="@+id/uf_female_radiobutton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/female"/>
    </RadioGroup>

    <!-- About me -->

    <TextView
        android:id="@+id/uf_aboutme_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:text="@string/aboutme"
        android:textColor="@color/orange_dark"
        android:textSize="@dimen/font_normal"/>


    <EditText
        android:id="@+id/uf_aboutme_box"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="top|start"
        android:hint="@string/tellusaboutyourself"
        android:inputType="textMultiLine"
        android:lines="8"
        android:maxLines="10"
        android:minLines="6"
        android:scrollbars="vertical"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

Upvotes: 1

Haresh Ramani
Haresh Ramani

Reputation: 390

try this

<EditText
        android:inputType="textMultiLine"
        android:lines="8"
        android:minLines="6" 
        android:gravity="top|left"
        android:maxLines="10"
        android:layout_height="wrap_content" 
        android:layout_width="fill_parent" 
        android:scrollbars="vertical" 
    />

Upvotes: 0

Rohit Suthar
Rohit Suthar

Reputation: 2693

Try android:singleLine="false" :

<EditText
    android:id="@+id/uf_aboutme_box"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="top|start"
    android:hint="@string/tellusaboutyourself"
    android:inputType="textMultiLine"
    android:lines="8"
    android:maxLines="10"
    android:minLines="6"
    android:scrollbars="vertical"
    android:singleLine="false" />

Upvotes: 3

Related Questions