<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:weightSum="3" >
<TextView
android:id="@+id/info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="bottom|center"
android:maxLines="10"
android:scrollbars="vertical"
android:text="@string/hello_world"
android:textSize="20sp" />
<SeekBar
android:id="@+id/seek_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
I set a TextView and a seekbar, then set the listener of seekbar to append a line of text into the textview each time the value changes, as the textview get more and more text, the app totally slow down, I try to use things like maxlines or ellipsize to limit, to truncate the text, but seems not working.
Are there any build in things I can use?
here is the java code:
this.seek.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
info.append("\n" + "Stop" + "Current: " + seekBar.getProgress());
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
info.append("\n" + "Start" + "Current: " + seekBar.getProgress());
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
// TODO Auto-generated method stub
info.append("\n" + "Changing" + "Current: " + seekBar.getProgress());
}
});