Note that there are some explanatory texts on larger screens.

plurals
  1. POResizing TextView to fit text (with a nine patch background image)?
    primarykey
    data
    text
    <p>I am using a TextView and a 9 patch image as its background for a messaging application in android.</p> <p>Here's what it looks like: <img src="https://i.stack.imgur.com/cIkhf.png" alt="enter image description here"></p> <p>See how for the blue, it is showing too much on the left? How can I reduce it when it decides that it has to wrap the text?</p> <p>I tried to access the Width and Height fields on the view in <code>public View getView(int position, View convertView, ViewGroup parent)</code>, however they are always zero (ps the TextView is located inside of a ListView and the <code>getView</code> method is inside the adapter for the ListView).</p> <p>Thank you!</p> <hr> <h2>TextView XML:</h2> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/message_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5sp" android:background="@drawable/bubble_b" android:shadowColor="@color/textShadow" android:shadowDx="1" android:shadowDy="1" android:text="Medium Text" android:textColor="#000000" android:textSize="16sp" android:lineSpacingMultiplier="1.1" /&gt; &lt;/LinearLayout&gt; </code></pre> <hr> <h2>Also, here's a screen of what the nine-patch does for it, so you can see how that works for it:</h2> <p><img src="https://i.stack.imgur.com/lkfZ9.png" alt="enter image description here"></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.
 

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