如何使文本视图滚动 [英] how to make a text view scroll

查看:95
本文介绍了如何使文本视图滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请向我提供文本视图的代码以进行滚动.该文本在编辑文本内.
快速响应受到高度赞赏.
谢谢.

Please provide me the code for the text view to get scroll. The text is inside the edit text.
Quick response highly appreciated.
Thanks.

推荐答案

您可以在文本视图之间使用滚动视图.
就像下面的代码一样.
希望它对您有用.

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.


要以编程方式滚动文本视图,请使用此代码.

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());
        }
    });
}


这篇关于如何使文本视图滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆