を使用してコメント セクション スタイルのレイアウトを実装しようとしてい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
が与えられます。アダプターの内容を交換できるようにしたいのですが、アイテムの数が常に同じであるとは限らないため、電話しませんでした。LinearLayoutManager
Adapter
ViewHolder
setHasFixedSize(true)
セットアップはほとんどの入力で機能しますが、問題は、一部のCharSequence
s が 100 行を超える長さであり、スクロール時に、RecyclerView
それらに到達する直前に約 0.5 秒間一時停止し、その後スクロールを続行することです。それも一度だけではありません。スクロールしてアイテムに戻ると、再びフリーズし、アイテムをスクロールしてビューから外し、スクロールしてアイテムに戻るたびに、ビューが再びフリーズします。これを修正するにはどうすればよいですか?