I found out that the problem was because my view was a sub-activity inside a tab.
To correctly override the transitions I've overridden the onPause method on the TabActivity and it now works as expected.
翻译过来的意思大概是:
我发现这个问题是因为我的View是一个Tab里面的子Activity。我在继承了TabActivity的子类Activity中重写OnPause方法后,动画正常。
- //没动画的代码
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.rlUpdate:
- Intent intent = new Intent(v.getContext(), NeedUpdateActivity.class);
- startActivity(intent);
- overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
- break;
- case .....
- }
- }
- //正常动画的代码
- public class MainActivity extends TabActivity {
- .....
- @Override
- protected void onPause() {
- super.onPause();
- overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
- }
- }