gpt4 book ai didi

Android:如何通过点击一个按钮从右到左和左右移动跑马灯文字

转载 作者:太空宇宙 更新时间:2023-11-03 11:35:28 27 4
gpt4 key购买 nike

如何通过单击一个按钮从右到左和左右移动字幕文本,我该怎么做,有人能帮助我吗?

最佳答案

试试这个;

Animation animationToLeft = new TranslateAnimation(400, -400, 0, 0);
animationToLeft.setDuration(12000);
animationToLeft.setRepeatMode(Animation.RESTART);
animationToLeft.setRepeatCount(Animation.INFINITE);

Animation animationToRight = new TranslateAnimation(-400,400, 0, 0);
animationToRight.setDuration(12000);
animationToRight.setRepeatMode(Animation.RESTART);
animationToRight.setRepeatCount(Animation.INFINITE);

TextView textViewMarqToLeft = (TextView) findViewById(R.id.textViewMarqToLeft);
TextView textViewMarqToRight = (TextView) findViewById(R.id.textViewMarqToRight);

textViewMarqToLeft.setAnimation(animationToLeft);
textViewMarqToRight.setAnimation(animationToRight);
String textLeft = "Left marquue"
String textRight = "Right marquue"
textViewMarqToLeft.setText(textLeft);
textViewMarqToRight.setText(textRight);

关于Android:如何通过点击一个按钮从右到左和左右移动跑马灯文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11503830/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com