Android TextView 自动滚动

标签 android textview autoscroll

我正在尝试在表格布局的 TextView 中实现自动滚动。我看到自动滚动仅发生在第一个 TextView 框上,而不是所有框上。

        <TableRow
            android:id="@+id/GuessWordtableRow1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="1dip"
            android:layout_weight="1"
            android:background="#d65906" >

            <TextView
                android:id="@+id/GuessWordtextView1a"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_margin="1dip"
                android:background="#fcc480"
                android:gravity="center"
                android:padding="1dip"
                android:text="1" >
            </TextView>

            <TextView
                android:id="@+id/GuessWordtextView11"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:marqueeRepeatLimit="marquee_forever"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:scrollHorizontally="true"
                android:layout_margin="1dip"
                android:layout_weight="1"
                android:background="#fcc480"
                android:clickable="false"
                android:gravity="center_vertical"
                android:padding="1dip"
                android:text="This is a very big statement which has to scroll" >

            </TextView>

            <TextView
                android:id="@+id/GuessWordtextView12"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:marqueeRepeatLimit="marquee_forever"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:scrollHorizontally="true"
                android:layout_margin="1dip"
                android:layout_weight="1"
                android:clickable="false"
                android:gravity="center_vertical"
                android:background="#fcc480"
                android:padding="1dip"
                android:text="This is a very big statement which has to scroll" >
            </TextView>

            <TextView
                android:id="@+id/GuessWordtextView13"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:singleLine="true"
                android:ellipsize="marquee"
                android:marqueeRepeatLimit="marquee_forever"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:scrollHorizontally="true"
                android:layout_margin="1dip"
                android:clickable="false"
                android:layout_weight="1"
                android:gravity="center_vertical"
                android:background="#fcc480"
                android:padding="1dip"
                android:text="This is a very big statement which has to scroll" >
            </TextView>
        </TableRow>

这就是我所拥有的。我看到文本仅针对 TextView ID GuessWordtextView11 滚动,而不针对 GuessWordtextView12 和 GuessWordtextView13。可能是什么原因?

最佳答案

将此属性更改为/添加到 TextView 中:

android:gravity="bottom"
android:scrollbars="vertical"

关于Android TextView 自动滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34470267/

相关文章:

android - 无法在 Android 中发送辅助功能事件

java - 从监听器列表中删除监听器

java - Android TextView 线条背景

android - 将 Textview 内容保持在 1 行并防止换行

android - 自动滚动 Web View

Android testCompile 项目不工作

android - 如何在 x 轴的左侧放置空间并显示条形图?

android - 如何使用android espresso test设置textview的可见性

c# - 更改面板起点

具有自动和自定义滚动功能的 Python Tkinter 文本小部件