0
我有一个小的但恼人的问题与动画在Android的意见。查看仍然存在但被动画移出后不可见
涉及什么: 我有一个FrameLayout在另一个FrameLayout包含在一个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>
我也写了一个动画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>
我想是翻译上点击我内心的FrameLayout(topbanner)从活动视图,除了它的20%,在为了使它在我点击它时重新出现。一种顶级菜单。
我设法申请我的动画,但即使我的布局被翻译,我可以触摸它,如果它仍然存在。任何建议?这是我的java代码:
@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();
}
对于动画编写动画侦听器[animation.setAnimationListener],并在动画结束时尝试将topbanner的可见性更改为View.GONE。 – Varun 2010-12-21 18:37:15