2
这里是xml
(activity_matches.xml
),其显示在下面的屏幕截图的输出在一个EditText
对象命名txaMatches
:如何在Android多行Edittext中加速平滑滚动?
<EditText
android:id= "@+id/txaMatches"
android:text= ""
android:scrollbars= "vertical"
android:layout_below= "@+id/pattern"
android:textColor= "@color/yellow_foreground"
android:textSize= "@dimen/matches_text"
android:focusable="false"
android:inputType="textMultiLine"
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentEnd= "true"
tools:ignore= "LabelFor"
android:typeface="monospace"
android:focusableInTouchMode="false"
android:paddingEnd="@dimen/matches_padding"
android:paddingStart="@dimen/matches_padding"
/>
谨以此multiline
EditText
对象的内容,从而平稳滚动如果用户在里面滑动,就会加速。
以下是我填写txaMatches
(使用doInBackground
)的方法。这是在Java代码中唯一的地方,我指的是它(当然我也定义和Java中初始化):
protected void onProgressUpdate(String... progress)
{
for (int i = 0; i < progress.length; i++)
if(progress[i].length() > 1) MatchesActivity.txaMatches.append("\n" + progress[i]);
else MatchesActivity.showLetter("Reading " + progress[i].charAt(0));
}
这是xml
来进行一个简单的变化?我应该使用ListView
吗? EditText
应该在ListView
之内吗?
我将不得不编写一些Java代码?
鉴于我提供的少量代码,我不期望很多细节。只是概述谷歌将是一个好的开始。
你有一些相关的问题和答案,请参阅:[Java的解决方案](http://stackoverflow.com/问题/ 29304118/how-to-make-edittext-scrolling-smooth),[webview workaround](http://stackoverflow.com/a/5594713/2668136)和[xml解决方法](http://stackoverflow.com/问题/ 12193482/Android的启用滚动-上的EditText)。 – Fllo