1

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.

Any clues to solve the issue.

Abhimoh

Prasad Dixit
  • 31
  • 1
  • 9
  • You limit the heigh of the LinearLayout and EditText so the EditText can't expand more line for you – user2652394 Aug 08 '13 at 06:50
  • you might try adding `android:Line:"number of lines that you want to use"` inside of your EditText refer http://stackoverflow.com/questions/2446544/android-vertical-alignment-for-multi-line-edittext-text-area – jayeshkv Aug 08 '13 at 06:51
  • Is it not expanding properly, or do you want it to be expanded initially? – Rich Schuler Aug 08 '13 at 06:51
  • Change edittext height to wrap content and try... – Mehul Ranpara Aug 09 '13 at 07:33
  • I did as per your suggestions but still it is not expanding and showing only a single line output. The rest of the output is flowing out of the edittext – Prasad Dixit Aug 09 '13 at 07:29

4 Answers4

1

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 -->
g00dy
  • 6,652
  • 2
  • 28
  • 42
0

Use

 android:layout_height="wrap_content"

for LinearLayout and

android:layout_height="wrap_content"

for EditText

Suji
  • 5,705
  • 2
  • 16
  • 16
  • I did as per your suggestions but still it is not expanding and showing only a single line output. The rest of the output is flowing out of the edittext – Prasad Dixit Aug 09 '13 at 06:08
0

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.

Sanal Varghese
  • 1,395
  • 4
  • 20
  • 46
0

I finally managed it by using textview and setMovementMethod(new ScrollingMovementMethod());

Thanks guys for help! Closing this post

Prasad Dixit
  • 31
  • 1
  • 9