So I am currently developing an app on Android Studio using Java and XML. I read in this post that we can justify the text in a TextView section by using the following property:
android:justificationMode="inter_word"
However, for some unknown reason this does not seem to work when deployed on my device. I tried checking if it also happens on AVDs and it does not, nor does it happen on the design canvas, in which also appears justified. So it works in AVDs and design canvas but doesn't work on 2 different actual mobile phones. I have also tried to change the text justification through Java but it seems to ignore the textView.setJustificationMode(JUSTIFICATION_MODE_INTER_WORD);
Is this a problem related to the build.gradle? Please, let me know if you guys have any idea on what might be causing this issue. Thanks!
Ps: Android Phone Versions: 12 and 8; Android Studio Version: Android Studio Chipmunk | 2021.2.1 Patch 2
Ps2: Below follows an XML file used in the app.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:justificationMode="inter_word"
android:textColor="@color/black"
android:textSize="15sp"
android:layout_marginTop="5dp"
android:padding="4dp"
android:text="Donec mollis varius ullamcorper. Curabitur blandit nisl sapien, gravida pellentesque metus hendrerit non. Vivamus vitae faucibus dolor. Etiam sit amet hendrerit nulla. Ut blandit eu mi quis ultrices. Proin ut quam quis neque efficitur ultrices. Duis ut laoreet libero. Curabitur lacinia ligula augue, sed ornare elit tempor vel. Sed bibendum scelerisque suscipit. Donec metus neque, tincidunt a urna aliquet, sodales sodales felis. Nullam ultricies neque vel lorem cursus, eget dapibus massa condimentum. Praesent rhoncus dolor tortor, non sodales ante mattis id. Sed accumsan porta eleifend. "/>
</RelativeLayout>
</RelativeLayout>
This is the result in the design canvas (and AVDs):
And this is the result in the actual mobile phone: