Java 如何在Android中实现文本消息的向上流显示?

Java 如何在Android中实现文本消息的向上流显示?,java,android,Java,Android,我正在尝试实现一种聊天风格的文本消息显示,其中第一行显示在底部,然后任何新的后续文本始终显示在底部,并向上移动任何先前的行 例如: 第一行出现了: Me: Hello! Me: Hello! Friend: Hi, there! How are you? Me: Hello! Friend: Hi, there! How are you? Me: Great, what about dinner this weekend? 第二行出现了: Me: Hello! Me: Hello!

我正在尝试实现一种聊天风格的文本消息显示,其中第一行显示在底部,然后任何新的后续文本始终显示在底部,并向上移动任何先前的行

例如:

第一行出现了:

Me: Hello!
Me: Hello!
Friend: Hi, there! How are you? 
Me: Hello!
Friend: Hi, there! How are you? 
Me: Great, what about dinner this weekend?
第二行出现了:

Me: Hello!
Me: Hello!
Friend: Hi, there! How are you? 
Me: Hello!
Friend: Hi, there! How are you? 
Me: Great, what about dinner this weekend?
第三行出现了:

Me: Hello!
Me: Hello!
Friend: Hi, there! How are you? 
Me: Hello!
Friend: Hi, there! How are you? 
Me: Great, what about dinner this weekend?
(问题:在标准文本视图中,文本将开始显示在视图的最顶部。我希望第一行文本显示在最底部,每次添加新内容都会向上移动之前的内容。)


那么,我如何实现这一点呢?这是我使用的标准小部件还是库?

经过一些实验后,以下是使文本首先从底部显示的解决方案:

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:orientation="vertical">

        <TextView
            android:id="@+id/outputTextView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textColor="#666666"/>
    </LinearLayout>

</ScrollView>


这解决了我的问题

问题:在标准文本视图中,向视图添加文本会添加到底部
这是打字错误吗?追加的文本不正是你想要的吗?是的,那是个打字错误。我已经编辑过了。谢谢