如何在Android的滚动显示多行文本? [英] How to display multiple lines of text with scrolling in android?
问题描述
我要显示多行文本,我特别的应用范围,使得用户可以滚动查看其他线路。我曾尝试的EditText
,但在它的上面产生键盘不能正常滚动。然后我试图的TextView
,它也不会正确地滚动,因为我想的文本。
I want to display multiple lines of text in my application in particular range such that user can scroll to view other lines. I have tried EditText
, but it generates keyboard on top of it and doesn't scroll properly. Then I tried TextView
, it also does not scroll the text properly as I wanted.
是否有任何其他选项可用?如果没有,那么如何垂直滚动文本的TextView
或的EditText
?我想在拖动滚动文本在的WebView
。不自动滚动。
Is there any other option available? If No, then how to scroll the text vertically in TextView
or EditText
? I want to scroll the text on drag as in WebView
. NOT auto scroll.
推荐答案
您可以限制的TextView
的高度来匹配你的用户希望看到的行数,然后简单地把你的的TextView
在滚动型
You can limit the Height of TextView
to match the number of lines you user wants to see, then simply put your TextView
in a ScrollView
我做了一个简单的例子来证明这一点......
I had done a simple example to demonstrate this...
<ScrollView android:layout_height="30dp"
android:layout_width="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:textSize="16sp"
android:id="@+id/tv1"
/>
</ScrollView>
这篇关于如何在Android的滚动显示多行文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!