Monday, April 15, 2013

[android help] Dynamically incresing the no of lines in editText

java - Dynamically incresing the no of lines in editText - Stack Overflow



















I have a layout with an editText field.I have to fit a large amount of data by default in the text box while loading it initially. Since i fit the data dynamically onCreate i dont know the size of the data initially. Can somebody tell me how can i increase the height of the editText field(Include multiple lines on large data) dynamically?



android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="About me :"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/dboard_classwall_txt_color" />

android:id="@+id/text_about_me"
android:layout_width="match_parent"
android:layout_height="34dp"
android:background="@drawable/editbox_profile_bg"
android:gravity="center_vertical"
android:imeOptions="actionNext"
android:inputType="textPostalAddress"
android:maxLength="@integer/roster_max_contact_details_length"
android:minHeight="50dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:singleLine="true"
android:textColor="@android:color/black"
android:textColorHint="@color/edit_prof_editbox_txt_color"
android:textCursorDrawable="@null" >





























I think you should use



android:id="@+id/text_about_me"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/editbox_profile_bg"
android:gravity="center_vertical"
android:imeOptions="actionNext"
android:inputType="textPostalAddress"
android:minHeight="50dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:singleLine="false"
android:textColor="@android:color/black"
android:textColorHint="@color/edit_prof_editbox_txt_color"
android:textCursorDrawable="@null" >


instead hope it helps























Just do this:


android:layout_height="34dp" => android:layout_height="wrap_content"
android:singleLine="true" => android:singleLine="false"


Regards




















lang-java






.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...