Note that there are some explanatory texts on larger screens.

plurals
  1. POSony SmartWatch - show a view over the Gallery on the
    text
    copied!<p>While playing around with the Gallery I've got another question (this probably should be simpler).</p> <p>I'm trying to show a view, lying in front of the Gallery, probably hiding it partially. Like a message dialog (Toast).</p> <p>In order to do so, I'm using a FrameLayout with a Gallery in the back, and ImageView with a transparent src in the front. When a dialog should be shown, I'm setting the src to the needed drawable through "sendImage".</p> <p>The problem is, as I assume, that the gallery/list items (that are added dynamically upon "onRequestListItem -> sendListItem") have more recent z-Order (as they have been added later), so the dialog is shown between the background of the Gallery and the transparent icons, representing the list items.</p> <p>Maybe someone will have an idea, how to avoid this situation?</p> <p>I am not aware of any way of adding views manually to the layout on the SmartWatch, or changing their zOrder through "bringToFront".</p> <p>Here is the source code:</p> <p><strong>gallery.xml</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;Gallery android:id="@+id/gallery" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;ImageView android:id="@+id/toast" android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/toast_dialog_message" /&gt; &lt;/FrameLayout&gt; </code></pre> <p><strong>gallery_item.xml</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ImageView android:id="@+id/item_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="20px" android:src="@drawable/item_icon" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p><strong>GalleryControlExtension.java</strong></p> <pre class="lang-java prettyprint-override"><code>sendImage(R.id.spritz_image, drawableResourceId); </code></pre> <p>P.S. In the emulator it works as expected: toast lies over the item_icon ...</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