views:

144

answers:

1

I have a listlayout with items in it that looks like this:

alt text

There is first an ImageView (the light) and then two textViews. All of this inside a TableLayout. (source here: http://code.google.com/p/switchctrl/source/browse/trunk/android/res/layout/device_switch.xml)

I want to have a rotating animation of a loading indicator Ontop of this light when this particular device (light) performs an action or an action is performed on it.

How do I put an animation ontop of this light imageview?

A: 

Try this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/Frame">

        <ImageView
            android:layout_height="wrap_content"
            android:id="@+id/Image1" />
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/Image2" />
    </FrameLayout>
    <LinearLayout
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:orientation="vertical"
        android:id="@+id/TextLayout">

        <TextView
            android:text="@+id/Line1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/Line1" />
        <TextView
            android:text="@+id/Line2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/Line2" />
    </LinearLayout>
</LinearLayout>
CaseyB
your layout code looks nice but some comments explaining what you want to achieve would help a lot.
Janusz
That worked like a charm, and yes. I will add comments, hopefully sooner rather than later.
Joelbitar
All it is in a `FrameLayout` with two `ImageViews` in it. I didn't figure it needed all that much explanation. ;)
CaseyB