Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to wrap content views rather than background drawable?
    primarykey
    data
    text
    <p>I try to implement the <code>Map View balloon</code> for GoogleMaps, but I block with the layout of the balloon.<br> The size of the balloon must be the content size, however, it takes the background drawable size, because it's bigger. As I have a quite large balloon <code>9-patch image</code>, provided by someone else, a small balloon content takes all the screen (drawable size). </p> <p>I saw this related question: <a href="https://stackoverflow.com/questions/4312133/how-to-wrap-content-views-rather-than-background-drawable">How to wrap content views rather than background drawable?</a> , which is exactly what I want, but it has no correct answer (using a <code>FrameLayout</code> makes the same problem, because the <code>ImageView</code> src will take the drawable size too, with <code>wrap_content</code> or <code>fill_parent</code>). </p> <p>Here is my layout:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:id="@+id/balloon_main_layout" android:orientation="horizontal" android:clickable="true" android:focusable="true" android:focusableInTouchMode="true" android:layout_width="wrap_content" android:background="@drawable/info_bulle_selector"&gt; &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="1"&gt; &lt;TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="TextView" android:id="@+id/balloon_item_title" android:textColor="#ffffff"&gt;&lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;ImageView android:id="@+id/balloon_close" android:layout_marginLeft="5dp" android:src="@drawable/fermer_selector" android:scaleType="fitXY" android:layout_height="30dp" android:layout_width="30dp"&gt;&lt;/ImageView&gt; &lt;/LinearLayout&gt; </code></pre> <p>Here is a screen of what I have (the red space has to be deleted):<br> <img src="https://i.stack.imgur.com/ElWi5.png" alt="Current baloon layout"> </p> <p>If you have any idea to solve this problem (which I often have when I design my layouts with background image), it would be great.<br> Thanks in advance. </p> <p>EDIT:<br> Here the nine-patch png: <img src="https://i.stack.imgur.com/GHwOC.png" alt="nine-patch balloon"></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.
 

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