I'm using a custom view which has a background picture and is used to draw stuff on it.
This view is ignoring android:layout_width="wrap_content and android:layout_height="wrap_content, it is not wrapping the background picture and is stretching and pushing the controls under the view out of the screen.
The custom view is in main LinearLayout, but where ever I put it, it behaves the same way.
I tried with setLayoutParams, 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.
I don't like the idea of statically setting the size because of different screen sizes.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<org.danizmax.tradar.MapView
android:id="@+id/mapView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<!-- koordinate -->
<LinearLayout android:id="@+id/controls"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="10sp"
android:paddingRight="10sp">
<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">
</TextView>
</LinearLayout>
<!-- radij -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="10sp"
android:paddingLeft="-5sp"
android:paddingRight="-5sp">
<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">
</Button>
<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">
</TextView>
<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">
</Button>
</LinearLayout>
<!-- alert togle -->
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="-5sp"
android:paddingRight="-5sp">
<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">
</Button>
<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">
</ToggleButton>
<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">
</Button>
</LinearLayout>
<!-- izpis zadnjega dogodka -->
<TextView android:id="@+id/timeStatText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="10sp"
android:gravity="center">
</TextView>
This is how it should look, the blue part is MapView:
any idea?