简体   繁体   English

为什么overridePendingTransition在Android 4.0或更高版本中不起作用?

[英]Why overridePendingTransition not work in android 4.0 or above version?

This code work well in my HTC Disire and Android 2.3.3 device,but not work in my android 4.0 phone——Huawei C8812? 这段代码在我的HTC Disire和Android 2.3.3设备上运行良好,但在我的android 4.0手机中无法正常工作 - 华为C8812?

public void changeNextActivity(Class<?> c){
    Intent intent = new Intent(this,c);
    this.startActivity(intent);
    overridePendingTransition(R.anim.animation_right_in,R.anim.animation_left_out);
}

try writing the overridePendingTransition code in the onCreate of the new activity. 尝试在新活动的onCreate中编写overridePendingTransition代码。

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        overridePendingTransition(R.anim.slide_in_hor, R.anim.slide_out_hor);
        setContentView(R.layout.main);

        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM