0

While playing around with the Gallery I've got another question (this probably should be simpler).

I'm trying to show a view, lying in front of the Gallery, probably hiding it partially. Like a message dialog (Toast).

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".

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.

Maybe someone will have an idea, how to avoid this situation?

I am not aware of any way of adding views manually to the layout on the SmartWatch, or changing their zOrder through "bringToFront".

Here is the source code:

gallery.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Gallery
        android:id="@+id/gallery"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <ImageView
    android:id="@+id/toast"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/toast_dialog_message" />

</FrameLayout>

gallery_item.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <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" />

</RelativeLayout>

GalleryControlExtension.java

sendImage(R.id.spritz_image, drawableResourceId);

P.S. In the emulator it works as expected: toast lies over the item_icon ...

Oleg Skr
  • 386
  • 2
  • 9
  • Better to post Code then make people picture it. Particularly the layout. – weston Oct 15 '13 at 07:20
  • You are definitely right! Thank you for pointing on that. – Oleg Skr Oct 15 '13 at 21:25
  • I never managed to get anything that is placed under the `Gallery` (or the `ListView`) element to show on screen, I'm surprised it's shown in the emulator at all. – Eir Oct 29 '13 at 17:59

0 Answers0