mathew-kurian/TextJustify-Android

Would this work in a RecyclerView?

aryehsinger opened this issue · 4 comments

Would this method work efficiently in a RecyclerView? So that each list-item would contain one DocumentView and the holder will use the span methods to set the justification?

Ideally it should. I have not tried it with a RecyclerView so I can't be for sure. If you can provide some test results, it would be great!

It works but it has an issue: Once you scroll back and forth the entire textview pops up, if the recyclerview item appears on screen, instead of getting smoothly presenting when scrolling in. So the rest of the screen is suddenly shifted to make space for the textview field.

@Nedeos I meet the same problem, have you deal with this?

I use a very simple test case.

    <com.bluejamesbond.text.DocumentView xmlns:ext="http://schemas.android.com/apk/res-auto"
        android:layout_marginBottom="24dp"
        android:id="@+id/body_text_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ext:documentView_antialias="true"
        ext:documentView_cacheConfig="auto_quality"
        ext:documentView_hyphen="-"
        ext:documentView_lineHeightMultiplier="1.2"
        ext:documentView_reverse="false"
        android:text="@string/upgrade_live_account_body"
        ext:documentView_textAlignment="justified"
        ext:documentView_textColor="?attr/primaryTextColor"
        ext:documentView_textFormat="plain"
        ext:documentView_textSize="16sp"
        ext:documentView_textSubPixel="true"
        ext:documentView_textTypefacePath="fonts/Roboto-Light.ttf" />

It doesn't really work well with RecyclerView. When I call notifyDataSetChanged, there will be flickering effect. If I replace com.bluejamesbond.text.DocumentView back to normal TextView, flickering effect gone.