I'm just looking to setup a simple TextView wrapped in a ScrollView which will automatically scroll down displaying the contents of the TextView in the same way as movies have their credits displayed. I do not want the user to have to interact with scroll bars. There are no buttons or other layouts I am working with on the screen so the credits fills the whole screen.
I have in my app a horizontally scrolling TextView which I setup in XML using marquee which was pretty easy but I am unsure of the easiest approach to have my text scroll vertically. This is the XML code I am working with will I need to have some code on the Java side to get this to work? Thanks in advance!
<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>
This is the way I am doing it in a horizontal scroll. It is set on 2 seconds and scrolls the view every 20 miliseconds
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 is my HorizontalScrollView
精彩评论