Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The @CommonsWare answer is correct. Android does not support "Full Justification" (or simply "Justification", as it is sometimes ambiguously referred to).</p> <p>However, android does support "Flush Left/Right Text Alignment". See the wikipedia article on <a href="http://en.wikipedia.org/wiki/Justification_%28typesetting%29" rel="nofollow noreferrer">Justification</a> for the distinction. Many people consider the concept of 'justification' to encompass full-justification as well as left/right text alignment, which is what they end up searching for when they want to do left/right text alignment. This answer explains how to achieve the left/right text alignment.</p> <p>It is possible to achieve Flush Left/Right Text Alignment (as opposed to Full Justification, as the question is asking about). To demonstrate I will be using a basic 2-column form (labels in the left column and text fields in the right column) as an example. In this example the text in the labels in the left column will be right-aligned so they appear flush up against their text fields in the right column. </p> <p>In the XML layout you can get the TextView elements themselves (the left column) to align to the right by adding the following attribute inside all of the TextViews:</p> <pre><code>&lt;TextView ... android:layout_gravity="center_vertical|right"&gt; ... &lt;/TextView&gt; </code></pre> <p>However, if the text wraps to multiple lines, the text would still be flush left aligned inside the TextView. Adding the following attribute makes the actual text flush right aligned (ragged left) inside the TextView:</p> <pre><code>&lt;TextView ... android:gravity="right"&gt; ... &lt;/TextView&gt; </code></pre> <p>So the <strong>gravity</strong> attribute specifies how to align the text inside the TextView <strong>layout_gravity</strong> specifies how to align/layout the TextView element itself.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload