以下是选项卡式活动类的代码
public class TabbedActivity extends TabActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
setContentView(R.layout.inbox_tab_layout);
TabHost tabHost = getTabHost();
// Tab for Songs
TabHost.TabSpec loc = tabHost.newTabSpec("Confirm Location");
loc.setIndicator("Confirm Location");
Intent location = new Intent(this, LocationTab.class);
loc.setContent(location);
// Tab for Videos
TabHost.TabSpec edit = tabHost.newTabSpec("Medinfi");
edit.setIndicator("Add Details");
Intent videosIntent = new Intent(this, EditTab.class);
edit.setContent(videosIntent);
tabHost.addTab(loc); // Adding songs tab
tabHost.addTab(edit); // Adding videos tab
}
@Override
protected void onResume() {
super.onResume();
Data.activityResumed();
}
@Override
protected void onPause() {
super.onPause();
Data.activityPaused();
}
}
我尝试使用overridependingintent
通过使用下面提到的代码覆盖onBackPressed来设置活动动画。
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
}
但代码不起作用。动画不会执行,而是发生默认动画。
答案 0 :(得分:0)
如果您从示例中获取,请注意,此代码非常旧