2017-07-25 13 views
0

私のアプリはロギングを行っており、ユーザーは数日間実行することができます。この場合、100k行のテキストをスクロールすることができます。Scrollview - 行数に関するTextViewの制限

これは合理的ではないようです。私はいくつかのメモリ制限を参照する必要があります。最大でテキストの行数は何行ですか?

最後の1k行のテキストを維持するローリングテキストビューを使用できますか? 1kとスクロールバーのmaxlinesでtextviewだけでそれを行うべきですか?私は、次のXMLを持っている瞬間

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.narb.log.MainActivity"> 

    <Button 
     android:id="@+id/btn" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:text="Start" 
     /> 

    <ScrollView 
     android:id="@+id/sv" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_margin="10dp" 
     android:layout_below="@id/btn" 
     > 

     <TextView 
      android:id="@+id/txt" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="This is the log number" 
      android:layout_margin="15dp" 
      /> 
    </ScrollView> 
</RelativeLayout> 

答えて

0

私があなただったら、私は100に最大ラインを設定しますとテキストの終わりにもっとオプションを読んで、ときにユーザーを追加しますクリックすると、maxlinesをtextview.maxlines + 100に設定し、表示するテキストがなくなるとその続きを非表示にします。

関連する問題