user2459539
user2459539

Reputation: 29

How to make edit text scrollable in android?

I am developing the UI for one activity.In that activity I have added one scroll view .In that scroll view I have added one linear layout & in that linear layout I have added one edit text.Now I want to make that edit text as scrollable so how it will be possible?

Upvotes: 1

Views: 9121

Answers (3)

Benil Mathew
Benil Mathew

Reputation: 1634

Try this code..

  // For horizontal scroll  
 android:scrollHorizontally="true"  

  //For vertical scroll
 android:scrollbars = "vertical"

Upvotes: 3

ridoy
ridoy

Reputation: 6322

From XML you can try with..

<EditText
    android:id ="@+id/editInput"
    android:layout_width ="0dip" 
    android:layout_height ="wrap_content" 
    android:layout_weight ="1" 
    android:inputType="textCapSentences|textMultiLine"
    android:maxLines ="4" 
    android:maxLength ="2000"   />

Else, follow these..

Upvotes: 0

Guilherme Gregores
Guilherme Gregores

Reputation: 1048

You can't put a scrollview inside of a scrollview

<ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="fill_parent"
        android:layout_height="100dp" >


        <EditText
            android:id="@+id/editText1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:text="KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK" >

            <requestFocus />
        </EditText>

    </ScrollView>

Upvotes: 3

Related Questions