Android的滚动型自动滚动文本添加 [英] Android scrollview autoscrolling as text is added

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

问题描述

我有一个包含在一个Android应用程序一个TextView滚动视图。这TextView的将文本追加到它不断在设定的时间间隔。滚动作品和文字增加了就好了,但我想要做的是滚动视图自动滚动下来的文字添加。作为新的文本被附加在底部,它会自动滚动下来,以匹配和旧的文本被推出的视线在顶部。什么是更好的是,一次添加文字滚动视图的底部,并将其推较早的文本向上的,但有一件事。

解决方案

 <滚动型
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:fillViewport =真
    >
    <的TextView
        机器人:ID =@ + ID /状态文本
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_gravity =底部/>
< /滚动型>
 

I have a scrollview containing a textview in an Android app. This textview will have text appended to it continuously at set intervals. Scrolling works and the text adds just fine, but what I'd like to do is have the scrollview autoscroll down as text is added. As new text is appended at the bottom, it automatically scrolls down to match and old text is pushed out of sight at the top. What would be even better is to add text to the bottom of the scrollview and have it push older text upward, but one thing at a time.

解决方案

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    >
    <TextView
        android:id="@+id/statusText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom" />
</ScrollView>

这篇关于Android的滚动型自动滚动文本添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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