我只是想设置一个简单的 TextView 包裹在 ScrollView 中,它将自动向下滚动显示 TextView 的内容,就像电影显示片尾字幕一样。我不希望用户必须与滚动条交互。屏幕上没有我正在使用的按钮或其他布局,因此制作人员名单填满了整个屏幕。
我在我的应用程序中有一个水平滚动的 TextView,我使用选取框在 XML 中设置它,这非常简单,但我不确定让文本垂直滚动的最简单方法。这是我正在使用的 XML 代码,我需要在 Java 端添加一些代码才能使其正常工作吗?提前致谢!
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/credits_text"
android:layout_alignParentTop="true"
android:focusable="true"
android:focusableInTouchMode="true"/>
</ScrollView>
这就是我在水平滚动中进行的方式。设置为 2 秒并每 20 毫秒滚动一次视图
public void scrollRight(final HorizontalScrollView h){
new CountDownTimer(2000, 20) {
public void onTick(long millisUntilFinished) {
h.scrollTo((int) (2000 - millisUntilFinished), 0);
}
public void onFinish() {
}
}.start(); }
h 是我的 HorizontalScrollView
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)