Android 水平自动旋转,如何使其循环?

Android 水平自动旋转,如何使其循环?,android,Android,我用这个实现了一个水平滚动视图。。 但是没有描述如何使文本在循环中滚动。有帮助吗?在xml中添加此内容: <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/sc"> <TextView android:id="@+id/mark

我用这个实现了一个水平滚动视图。。 但是没有描述如何使文本在循环中滚动。有帮助吗?

在xml中添加此内容:

<ScrollView 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:id="@+id/sc">


         <TextView
            android:id="@+id/mark"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:marqueeRepeatLimit="marquee_forever"
            android:scrollHorizontally="true"
            android:singleLine="true"
            android:text="Thanks Christian but I am trying to get my text to scroll downwards automatically I am able to scroll horizontally fine."
            android:textSize="50dp"
            android:layout_above="@+id/btn"
            android:layout_below="@+id/txt"  />

     </ScrollView>

当滚动视图到达底部时,只需将其滚动回顶部即可实现。这将使您的ScrollView无限循环

像这样的-

public void scrollDown(final ScrollView v){
new CountDownTimer(2000, 20) { 

    public void onTick(long millisUntilFinished) { 
        if((2000 - millisUntilFinished)==v.getBottom())
              millisUntilFinished=2000;
        v.scrollTo((int) (0,2000 - millisUntilFinished)); 
    } 

    public void onFinish() { 

    } 
 }.start(); }

虽然我自己还没有试过,但逻辑应该是可行的。

您的代码和我的代码有什么不同。我刚刚给出了满足需求的实际代码,您刚刚插入了textview和水平标记,就这样!!是的,这也是让我困惑的地方…..我真的不明白它为什么不工作…..我已经包括了android:MarqueerPeatLimit=“marquee_forever”这一行,并且我只在实现后发布了数据。它工作正常。你认为我会提供给你不工作的代码吗?如果你认为正确,请告诉我们,你可能想接受答案:-)Vinay,我用上面的逻辑做了水平滚动查看…现在我正在尝试你的逻辑。。。将尝试并接受它…如果((int)(2000-millisUntilFinished))==v.getBottom()和
v.scrollTo(0,(int)(2000-millisUntilFinished)),则将其更改为this-
我也试过了,它不起作用…它应该是v.getRight(),因为这是一个水平滚动视图,不是吗?
public void scrollDown(final ScrollView v){
new CountDownTimer(2000, 20) { 

    public void onTick(long millisUntilFinished) { 
        if((2000 - millisUntilFinished)==v.getBottom())
              millisUntilFinished=2000;
        v.scrollTo((int) (0,2000 - millisUntilFinished)); 
    } 

    public void onFinish() { 

    } 
 }.start(); }