I am new to animations. I have a spin Animation on a button. The problem is when that button animation is executed the button intersects other buttons in the layout. So during animation the moving button cannot be seen since it is being covered up by other buttons. Any idea on how to make my animation stay on the top layer of the layout? I would like to figure out a solution that is API 8 compatible.
//create shake animation
final Animation shakeIt = AnimationUtils.loadAnimation(this, R.anim.shake);
findViewById(R.id.button_spin).startAnimation(shakeIt);
// use shake animation
spinnerButton.startAnimation(shakeIt);
EDIT: (here is a lot more info)
So i have played with it over the past few hours and discovered some more things. Lecho intuition is correct, the z order is the driving factor in whether a widget goes "above" or "below" another one. The problem I am facing is could be because of two things:
The button that is at the front of view view (and i want to move it back) has text that is edited near the end of the activity. Does adding text forcing the widget to redraw change the Z order of that view???
The button text is changed in the onResume() and it seems that I'm not able to change the Z-order of the buttons in that method???
answers to these above 2 questions would solve my problem
Edit 2: XML in question
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight=".7"
android:layout_marginTop="5dp" >
<Button
android:id="@+id/categoryButton"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/drop"
android:prompt="@string/planet_prompt"
android:paddingRight="20dp"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="35dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.1"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="horizontal"
android:layout_weight="1.5" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1" >
</LinearLayout>
<Button
android:id="@+id/button_spin"
android:layout_width="0dp"
android:layout_weight="2.35"
android:layout_height="fill_parent"
android:background="@drawable/letseat"
android:layout_gravity="center_horizontal"
android:gravity="center" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1" >
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="vertical">
<Button
android:id="@+id/button_additems"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="@drawable/add_rest"
android:gravity="center_horizontal" />
<Button
android:id="@+id/button_showrestaurant"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="@drawable/edit_rest"
android:gravity="center_horizontal" />
<Button
android:id="@+id/button_nearbyplaces"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent"
android:background="@drawable/whats_near"
android:gravity="center_horizontal" />
</LinearLayout>
</LinearLayout>