Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you are not doing the right thing. If you want a text to appear inside a white box (or even resize it, if there is to many text to fit to it) - you can still avoid any layouts ad do it with <strong>only one</strong> TextView.</p> <p>Please have a look what is <strong><code>NinePatch</code></strong> image in Android: <a href="http://developer.android.com/reference/android/graphics/NinePatch.html" rel="noreferrer">http://developer.android.com/reference/android/graphics/NinePatch.html</a></p> <p><a href="http://developer.android.com/tools/help/draw9patch.html" rel="noreferrer">http://developer.android.com/tools/help/draw9patch.html</a> - drawing tools</p> <p>So basically you will need only 1 textView and your image, properly converted to 9-patch with 2nd link. (Basically - just add a few black pixels on image border). No just set this 9-patch as a background of textView. It will place text right where you need, and will shrink white box if you'll define so in 9-patch.</p> <p><strong>UPD:</strong> Please find the resulting screenshot: <img src="https://i.stack.imgur.com/MAynH.png" alt="enter image description here"></p> <p>As you can see, textView not handles WhiteBox" itself, filling it with text and resizing the box if necessary.</p> <p>Here is how to make it work:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;TextView android:id="@+id/first" android:background="@drawable/back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Manymanymany text Manymanymany text Manymanymany text Manymanymany text Manymanymany text Manymanymany text" /&gt; &lt;TextView android:layout_below="@+id/first" android:background="@drawable/back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Not so many text" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>And here is your image, converted to 9patch. Just place it to "drawable/" folder. Note: it MUST have "back.9.png" name. <img src="https://i.stack.imgur.com/Df3XN.png" alt="enter image description here"></p> <p>For details of how 9patch works you can check links above. The main idea: by making black dots on left and top border - you specify which part of the image will be stretched when image must be upscaled. By making dots on right/bottom side you tell the View where to place the content. In our case content is a text of the TextView.</p> <p>Hope it helps, good luck</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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