How can I use marquee text in an android application?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Just put these params to your TextView - It works :D
And you also need to
setSelected(true)
:Greetings, Christopher
To get this to work, I had to use ALL three of the things (ellipsize, selected, and singleLine) mentioned already:
In XML file, you need to add following additional attributes in a TextView to get a marquee like feature:
In MainActivity.java file, you can get the reference of this TextView by using findViewById() and you can set the following property to this TextView to make it appear like a marquee text:
That's all you need.
You can use a TextView or your custom TextView. The latter is when the textview cannot get focus all the time.
First, you can use a TextView or a custom TextView as the scrolling text view in your layout .xml file like this:
NOTE: in the above code snippet com.example.myapplication is an example package name and should be replaced by your own package name.
Then in case of using CustomTextView, you should define the CustomTextView class:
Hope it will be helpful to you. Cheers!
I found a Problem with marquee that it can't be used for short strings(As its function is only to Show Long strings).
I suggest Use Webview If you want to move short strings horizontally. Main_Activity.java Code:`
main_activity.xml code: