Reputation: 31
I am reading data from file buffer and storing it into a string. I am loading the same string by setext to editText component. However knowing multiple lines it is displaying entire file into only a single line. My xml file is as below:
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/btnlogclear"
android:layout_toRightOf="@+id/btnemaillog" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="224dp"
android:orientation="vertical" >
<EditText
android:id="@+id/editLog"
android:layout_width="wrap_content"
android:layout_height="177dp"
android:ems="10"
android:enabled="false"
android:gravity="left|top"
android:inputType="textMultiLine"
android:scrollbars="vertical"
android:scrollHorizontally="false" >
<requestFocus />
</EditText>
</LinearLayout>
</ScrollView>
It is still showing a single line.
Abhimoh
Upvotes: 1
Views: 1783
Reputation: 31
I finally managed it by using textview and setMovementMethod(new ScrollingMovementMethod());
Thanks guys for help! Closing this post
Upvotes: 0
Reputation: 1486
Change the height of LinearLayout to
wrap_content
so that EditText will get enough space to expand.Now the EditText can only extend upto 224dp. I think that's the reason why EditText is not showing multiple lines.
Upvotes: 0
Reputation: 6788
Use this in the xml:
android:inputType="textMultiLine" <!-- Multiline input -->
android:minLines="6" <!-- Optional min number of lines -->
android:maxLines="10" <!-- Optional max number of Lines -->
Upvotes: 1
Reputation: 6044
Use
android:layout_height="wrap_content"
for LinearLayout and
android:layout_height="wrap_content"
for EditText
Upvotes: 0