Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The widgets actually do need to be declared before they can be referenced, at least prior to Android 2.2. You can try something like the below, I'm not certain of how you wanted the In/Out buttons placed, but this should give a general idea:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;Button android:id="@+id/up" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:drawableLeft="@drawable/up" /&gt; &lt;Button android:id="@+id/left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:drawableLeft="@drawable/left" /&gt; &lt;Button android:id="@+id/right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:drawableLeft="@drawable/right" /&gt; &lt;Button android:id="@+id/down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:drawableLeft="@drawable/down" /&gt; &lt;Button android:id="@+id/in" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:text="@string/test_in" /&gt; &lt;Button android:id="@+id/out" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:text="@string/test_out" /&gt; &lt;ImageView android:id="@+id/tile" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5px" android:layout_above="@id/down" android:layout_toRightOf="@id/left" android:layout_toLeftOf="@id/right" android:layout_below="@id/up" android:layout_gravity="center" android:src="@drawable/loading" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Basically, you want to place the arrows and in/out buttons first, aligned with the parent (the main window). Then, use above/below/RightOf/LeftOf to define the edges of the map tile. I'm not sure offhand whether ImageView uses layout_gravity or just gravity (I always get them confused), but if not one, just try the other. This is from the top of my head - untested - so let me know if something quirky happens.</p> <p>EDIT: Second suggestion. This is more similar to yours (I wasn't thinking about the map not being fill_parent), but using gravity instead of centerHorizontal, and using just layout_above/below/left/right instead of alignParent*<em>*</em>.</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/tile" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="5px" android:gravity="center" android:src="@drawable/loading" /&gt; &lt;Button android:id="@+id/up" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/tile" android:gravity="center_horizontal" android:drawableLeft="@drawable/up" /&gt; &lt;Button android:id="@+id/left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/tile" android:gravity="center_vertical" android:drawableLeft="@drawable/left" /&gt; &lt;Button android:id="@+id/right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/tile" android:gravity="center_vertical" android:drawableLeft="@drawable/right" /&gt; &lt;LinearLayout android:id="@+id/bottom" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/tile" android:gravity="center_horizontal" &gt; &lt;Button android:id="@+id/out" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/test_out" android:padding="5dp" /&gt; &lt;Button android:id="@+id/down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableLeft="@drawable/down" android:padding="5dp" /&gt; &lt;Button android:id="@+id/in" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/test_in" android:padding="5dp" /&gt; &lt;/RelativeLayout&gt; </code></pre>
    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. 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