Android Animations similar to make marquee vertical

后端 未结 1 1141
无人共我
无人共我 2021-01-27 10:18

Apologies for this basic question, as I\'m a complete novice to Android:

I can make my TextView scroll horizontally on one line.

But what I need is

1条回答
  •  伪装坚强ぢ
    2021-01-27 10:54

    refer this GitHub Project it has a wonderful example in it too.

    Edit: make your xml some thing like this:

    
    

    In your activity class:

    private VerticalMarqueeTextView _txtView1; //declare a member variable
    

    In onCreate():

    _txtView1 = (VerticalMarqueeTextView) findViewById(R.id.mTextView1);
    _txtView1.setMovementMethod(new ScrollingMovementMethod());
    

    And in other activity lifecycle methods:

    @Override
    protected void onResume() {
    
        // Start or restart the Marquee if paused.
        if (_txtView1.isPaused()) {
            _txtView1.resumeMarquee();
        }
        super.onResume();
    }
    
    @Override
    protected void onPause() {
    
        // Pause the Marquee when the Activity pauses.
        _txtView1.pauseMarquee();
        super.onPause();
    }
    
    @Override
    protected void onDestroy() {
    
        _txtView1.stopMarquee();
        super.onDestroy();
    }
    

    0 讨论(0)
提交回复
热议问题