0

を使用してコメント セクション スタイルのレイアウトを実装しようとしていRecyclerViewます。this に入力するために使用するCharSequenceオブジェクト (それぞれの結果)のリストがあります。Html.fromHtml(String, null, null)RecyclerView

RecyclerViewレイアウトは次のとおりです。

<android.support.v7.widget.RecyclerView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

TextViewレイアウトは次のとおりです。

<TextView
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="16dp"
    android:lineSpacingMultiplier="1.4"
    android:textAppearance="@style/TextAppearance.AppCompat.Body1"
    android:textIsSelectable="true"
    android:textSize="15sp"/>

は次のViewHolderとおりです。

public final class ItemHolder extends RecyclerView.ViewHolder {
    @Bind(R.id.text) TextView text; // ButterKnife

    public ItemHolder(View itemView) {
        super(itemView);
        ButterKnife.bind(this, itemView);
        text.setMovementMethod(new LinkMovementMethod());
    }

    public void bind(CharSequence cs) {
        text.setText(cs);
    }

残りはかなり標準的です。リストから読み取ってインスタンスを作成するとRecyclerViewが与えられます。アダプターの内容を交換できるようにしたいのですが、アイテムの数が常に同じであるとは限らないため、電話しませんでした。LinearLayoutManagerAdapterViewHoldersetHasFixedSize(true)

セットアップはほとんどの入力で機能しますが、問題は、一部のCharSequences が 100 行を超える長さであり、スクロール時に、RecyclerViewそれらに到達する直前に約 0.5 秒間一時停止し、その後スクロールを続行することです。それも一度だけではありません。スクロールしてアイテムに戻ると、再びフリーズし、アイテムをスクロールしてビューから外し、スクロールしてアイテムに戻るたびに、ビューが再びフリーズします。これを修正するにはどうすればよいですか?

4

0 に答える 0