Skip to content Skip to sidebar Skip to footer

Justifing A Text (that Is, Make It Fit In A Textview And Cover All Space)

I'm trying to make an app that involves writing some poems in Arabic language, however I'm having difficulties in making the poem look justified to look nice when reading them. I'

Solution 1:

set text width to fill the parent and set margin to element. use gravity center.

       <TextView
        android:id="@+id/poem1_textView"
        android:layout_width="match_parent"
        android:layout_weight="1"
        android:gravity="center"
        android:textSize="15sp"
        android:margin="18dp"    
        tools:text="Some text here"
        />

that could help you to simulate an justified text, if you want a better fix or if you are using android 8.0. it supports justification on texts. Look at this answer and try those libraries. Android TextView Justify Text

I Hope it helps.

Post a Comment for "Justifing A Text (that Is, Make It Fit In A Textview And Cover All Space)"