Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid custom view is ignoring layout params im xml completely, and is stretching over the whole screen
    text
    copied!<p>I'm using a custom view which has a background picture and is used to draw stuff on it. </p> <p>This view is ignoring <strong>android:layout_width="wrap_content</strong> and <strong>android:layout_height="wrap_content</strong>, it is not wrapping the background picture and is stretching and pushing the controls under the view out of the screen.</p> <p>The custom view is in main LinearLayout, but where ever I put it, it behaves the same way.</p> <p>I tried with <strong>setLayoutParams</strong>, but physical size is somehow still the same under visible controls and the size is important because of the coordinates I save for other times. It is even present under the custom title, and coordinates are returned as negatives and thats also a problem. </p> <p>I don't like the idea of statically setting the size because of different screen sizes.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"&gt; &lt;org.danizmax.tradar.MapView android:id="@+id/mapView" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;!-- koordinate --&gt; &lt;LinearLayout android:id="@+id/controls" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="10sp" android:paddingRight="10sp"&gt; &lt;TextView android:id="@+id/coordsText" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textStyle="bold" android:textSize="15sp" android:gravity="center" android:layout_weight="1"&gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;!-- radij --&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingBottom="10sp" android:paddingLeft="-5sp" android:paddingRight="-5sp"&gt; &lt;Button android:text="" android:id="@+id/ButtonInc" android:background="@drawable/leftbuttonani" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"&gt; &lt;/Button&gt; &lt;TextView android:id="@+id/radiusSize" android:layout_width="fill_parent" android:layout_height="fill_parent" android:textStyle="bold" android:textSize="16sp" android:gravity="center" android:layout_weight="1" android:paddingLeft="0sp" android:paddingRight="0sp"&gt; &lt;/TextView&gt; &lt;Button android:text="" android:id="@+id/ButtonDec" android:background="@drawable/rightbuttonani" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"&gt; &lt;/Button&gt; &lt;/LinearLayout&gt; &lt;!-- alert togle --&gt; &lt;LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="-5sp" android:paddingRight="-5sp"&gt; &lt;Button android:text="" android:id="@+id/ButtonDec" android:background="@drawable/buttonani" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"&gt; &lt;/Button&gt; &lt;ToggleButton android:id="@+id/toggleAlert" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#D8D8D8" android:background="@drawable/buttonani" android:textOn="@string/alertOn" android:textOff="@string/alertOff" android:textStyle="bold" android:layout_weight="0.5" android:paddingTop="1sp"&gt; &lt;/ToggleButton&gt; &lt;Button android:text="" android:id="@+id/ButtonDec" android:background="@drawable/buttonani" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1"&gt; &lt;/Button&gt; &lt;/LinearLayout&gt; &lt;!-- izpis zadnjega dogodka --&gt; &lt;TextView android:id="@+id/timeStatText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textStyle="bold" android:textSize="10sp" android:gravity="center"&gt; &lt;/TextView&gt; </code></pre> <p></p> <p>This is how it should look, the blue part is <strong>MapView</strong>:</p> <p><img src="https://i.stack.imgur.com/3EjxK.png" alt="alt text"></p> <p>any idea?</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