3

私はそれを解決しました。助けが必要な場合、これは私のメールアドレスです:emmets@foxmail.com

xmlレイアウト:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<RelativeLayout
    android:id="@+id/newLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
</RelativeLayout>

<RelativeLayout
    android:id="@+id/oldLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
</RelativeLayout>

Javaコード、ActivityGroupを拡張する必要があります:

LocalActivityManager localLocalActivityManager = getLocalActivityManager();
    paramIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    Window localWindow = localLocalActivityManager.startActivity("flag", NewActivity.class);
    localWindow.addFlags(1);
    View localView = localWindow.getDecorView();
    localView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
    newLayout.addView(localView);
 dAnimation upOut = AnimationUtils.loadAnimation(this, R.anim.push_up_out);
     Animation zoomEnter = AnimationUtils.loadAnimation(this, R.anim.zoom_enter);
newLayout.startAnimation(zoomEnter);
oldLayout.startAnimation(upOut);
4

1 に答える 1

1

このコードを試してください

button.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            final View l = findViewById(R.id.main);

            Animation a = AnimationUtils.loadAnimation(
                    YourActivity.this, android.R.anim.fade_out);
            a.setDuration(200);
            a.setAnimationListener(new AnimationListener() {

                public void onAnimationEnd(Animation animation) {
                        // Do what ever you need, if not remove it.  
                }

                public void onAnimationRepeat(Animation animation) {
                        // Do what ever you need, if not remove it.  
                }

                public void onAnimationStart(Animation animation) {
                        // Do what ever you need, if not remove it.  
                }

            });
            l.startAnimation(a);
        }
    });
于 2013-02-27T07:29:08.713 に答える