Using the library TextJustify-Android there are two issues for me
Activity for the first time only when I open it for the next time. Providing image from emulator (same situation on phone)

maxLines, nothing helped. Providing the full `XML<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/blog"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="420dp"
android:id="@+id/blogWrapper"
android:layout_marginBottom="15dp"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/blogInfo"
android:layout_marginBottom="15dp"
>
<ImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:id="@+id/blogImage"
android:scaleType="centerCrop"
/>
<TextView
android:text="@string/blog_title"
android:id="@+id/blogTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_gravity="center_vertical"
android:layout_below="@+id/blogBlogger"
android:layout_alignLeft="@+id/blogBlogger"
android:layout_alignStart="@+id/blogBlogger"
/>
<TextView
android:text="@string/blog_blogger"
android:id="@+id/blogBlogger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:textStyle="bold"
android:layout_toEndOf="@+id/blogImage"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/blogImage"
android:layout_marginLeft="10dp"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_below="@+id/blogInfo"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
>
<com.bluejamesbond.text.DocumentView
xmlns:ext="http://schemas.android.com/apk/res-auto"
android:id="@+id/blogText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
ext:documentView_cacheConfig="auto_quality"
ext:documentView_antialias="true"
ext:documentView_hyphen="-"
ext:documentView_reverse="false"
ext:documentView_textAlignment="justified"
ext:documentView_textFormat="plain"
ext:documentView_textSize="14sp"
ext:documentView_textSubPixel="true"
/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/blogButtonsSocial"
android:layout_below="@+id/blogWrapper"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
>
<ImageView
android:id="@+id/blogLike"
android:layout_height="60dp"
android:layout_width="60dp"
android:background="@drawable/global_button_dislike_image"
android:textAlignment="center"
android:gravity="center"
android:textColor="#FFFFFF"
android:layout_marginBottom="28dp"
android:layout_marginRight="15dp"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
>
<ImageView
android:text="FB"
android:src="@drawable/global_button_social_facebook_image"
android:id="@+id/blogLinkFacebook"
android:layout_width="0dp"
android:layout_weight="0.3"
android:layout_height="45dp"
android:background="@drawable/global_button_social_facebook"
android:textAlignment="center"
android:gravity="center"
android:textColor="#FFFFFF"
android:layout_marginRight="5dp"
/>
<ImageView
android:src="@drawable/global_button_social_twitter_image"
android:id="@+id/blogLinkTwitter"
android:layout_width="0dp"
android:layout_weight="0.3"
android:layout_height="45dp"
android:background="@drawable/global_button_social_twitter"
android:textAlignment="center"
android:gravity="center"
android:textColor="#FFFFFF"
android:layout_marginLeft="5dp"
/>
</LinearLayout>
<ImageView
android:id="@+id/blogDislike"
android:layout_height="60dp"
android:layout_width="60dp"
android:background="@drawable/global_button_like_image"
android:textAlignment="center"
android:gravity="center"
android:textColor="#FFFFFF"
android:layout_marginLeft="15dp"
/>
</LinearLayout>
<ImageView
android:id="@+id/loginFooter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/global_footer_skyline"
android:layout_alignParentBottom="true"
/>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/blogLinkTwitterPopup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
tools:context=".BlogActivity"
>
</RelativeLayout>
</RelativeLayout>
Remove the maxLines attribute from the XML layout. Currently you are setting the maxLines which seems to limit the content to just 100 lines. And don't put DocumentView inside a ScrollView because DocumentView is actually a subclass of ScrollView.
As a sidenote, I recommend you check out the SqueezeHyphenator which will hyphenate your text inside DocumentView
UPDATE: It works fine for me. You can see my demo. I can post my demo code on Github upon request.
Maybe you are not calling documentView.requestLayout() after you set the text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With