gpt4 book ai didi

android:动画效果的第一个 Activity 和下一个 Activity 同时进行

转载 作者:太空狗 更新时间:2023-10-29 14:22:58 25 4
gpt4 key购买 nike

我解决了。如果你需要帮助,这是我的邮箱: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);

最佳答案

试试这段代码

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);
}
});

关于android:动画效果的第一个 Activity 和下一个 Activity 同时进行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15104901/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com