自动向下滚动编辑文本
我有一个由 3 个按钮和一个 EditText 组成的 Activity,当按下按钮时我在其中添加(使用 EditText.append(String))一些文本...问题是我找不到显示最后一个的方法当文本行达到 EditText 的下限时。
有时它会起作用,当我添加更多文本行时,文本会上升,但例如,当我触摸屏幕并移动 EditText 时,它会停留在那里
。我发现的“解决方案”是“滚动条”,但我不明白它是如何工作的。谁能帮我解决这个问题吗?
提前致谢。
I have an Activity that consist in 3 buttons and a EditText, where I add (with EditText.append(String)) some text when the buttons are pressed... The problem is that i couldn't find the way to show the last text lines when they reach the lower limit of the EditText..
Sometimes it works, and the text go up as i add more text lines, but for example, when i touch the screen and move the EditText, it stays there..
The only "solution" that i found was the "scroller", but i don't understand how it works. Can anyone help me with this?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这并不是问题的真正答案,但对于那些可能有与我相同问题的人:
我最终将
TextView
放入ScrollView
中,并使用 < ScrollView 的 code>fullScroll(View.FOCUS_DOWN) 功能。这样我就可以看到 TextView 的末尾。我可以这样做,因为我不需要编辑添加的文本。
希望有帮助。
It is not really the answer to the question, but for the ones that maybe have the same question as me:
I finally put a
TextView
in aScrollView
, and used thefullScroll(View.FOCUS_DOWN)
functionality of the ScrollView.. This way i could see the end of the TextView.I could do this because i didn't need to edit the text added.
Hope it helps.