Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
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

To programmatically scroll a text view use this code.

C#
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());
        }
    });
}
 
Share this answer
 
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.
 
Share this answer
 
v2
Comments
Adarsh0007 21-Sep-12 5:17am    
Thank you it solve the purpose.
Aditya_Pandey 21-Sep-12 7:24am    
You're welcome dear!

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900