Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Android
Please provide me the code for the text view to get scroll. The text is inside the edit text.
Quick response highly appreciated.
Thanks.
Posted 20-Sep-12 23:07pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can use the Scroll View and in between the Text view.
Just Like the code below.
Hope it works fine for you.
 
            <scrollview>
        android:id="@+id/ScrollView01"  
      android:layout_height="150px"   
      android:layout_width="fill_parent">  
 

                <textview>
                    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:background="@drawable/b1"
                    android:gravity="center"
                    android:text="TextView"
                    android:textColor="#000000"
                     />
 
    </textview></scrollview>  
 

 
You can also programmaticaly do it. This is the easy way.
  Permalink  
v2
Comments
Adarsh0007 at 21-Sep-12 5:17am
   
Thank you it solve the purpose.
Aditya_Pandey at 21-Sep-12 7:24am
   
You're welcome dear!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

To programmatically scroll a text view use this code.
 
mTextStatus = (TextView) findViewById(R.id.TEXT_STATUS_ID);
mScrollView = (ScrollView) findViewById(R.id.SCROLLER_ID);
 
private void scrollToBottom()
{
    mScrollView.post(new Runnable()
    {
        public void run()
        {
            mScrollView.smoothScrollTo(0, mTextStatus.getBottom());
        }
    });
}
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.140709.1 | Last Updated 21 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid