I have a small but annoying probleme with animations on views in Android.
What is involved: I have a FrameLayout in another FrameLayout contained in a xml.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="@android:id/list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"></ListView>
<FrameLayout
android:id="@+id/TopBanner"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ImageView01"
android:layout_width="fill_parent"
android:background="@drawable/topmenu"
android:layout_height="150dip"></ImageView>
<Gallery
android:id="@+id/Gallery01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></Gallery>
</FrameLayout>
</FrameLayout>
I also wrote an animation XML:
<?xml version="1.0" encoding="utf-8"?>
<set
android:interpolator="@android:anim/bounce_interpolator"
xmlns:android="http://schemas.android.com/apk/res/android"
fillEnabled="true"
android:fillBefore="true"
android:fillAfter="true">
<translate
android:duration="500"
android:fromYDelta="0"
android:toYDelta="-80%" />
</set>
What I want is to translate on click my inner frameLayout (topbanner) out of the activity view, except 20% of it, in order to make it re-appear when I click on it. A kind of top menu.
I managed to apply my animation, but even if my layout is translated, I can touch it as if it was still there. Any suggestion? Here is my java code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
UserSettings = getSharedPreferences("net.blabla_preferences", MODE_WORLD_WRITEABLE);
tab = getIntent().getExtras().getInt("net.blabla.FigureTab");
setContentView(R.layout.layout_figure_list);
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.animation_topbanner);
topbanner = (FrameLayout) findViewById(R.id.TopBanner);
topbanner.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
v.startAnimation(animation);
}
});
load();
}