简体   繁体   中英

How to set the Text of a ScrollingMovementMethod onClick to the top

I have a ScrollingMovementMethod with a TextView :

android:ellipsize="marquee"
android:maxLines="5"
android:scrollbars = "vertical"

I want that if I scroll the text of my TextView down, I can jump to the top of the text if I click a button. How can I do that?

text is the TextView. This comes into the onClick:

text.setMovementMethod(new ScrollingMovementMethod());
text.scrollTo(0, 0)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM