对于我的应用,我通过定义ActionBar
和layout
来制作自定义icons
。那ActionBar
从两边滑落。现在,当我从sliding menu
选择一个选项时,我会从当前activity
导航到下一个activity
,但在此activity
中,我还想显示我已定义的ActionBar
使用action作为之前activity
的工作。请帮我 。我的代码在这里......
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dash_board);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
googleMap = mapFragment.getMap();
mNav = new SimpleSideDrawer(this);
mNav.setLeftBehindContentView(R.layout.activity_behind_left_simple);
initialization();
findViewById(R.id.acti_login_backImg).setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
mNav.toggleLeftDrawer();
}
});
mNav.setRightBehindContentView(R.layout.activity_behind_right_simple);
findViewById(R.id.acti_dashboard_profileSlideImg).setOnClickListener(
new OnClickListener() {
@Override
public void onClick(View v) {
mNav.toggleRightDrawer();
}
});
我的事件听众
@Override
protected void onStart() {
super.onStart();
acti_dashboard_backToMapTxt.setOnClickListener(this);
acti_dashboard_zoneTxt.setOnClickListener(this);
acti_dashboard_historyTxt.setOnClickListener(this);
acti_dashboard_settingTxt.setOnClickListener(this);
acti_dashboard_profileTxt.setOnClickListener(this);
acti_dashboard_newLooqiTxt.setOnClickListener(this);
acti_dashboard_languageiTxt.setOnClickListener(this);
acti_dashboard_unsubscribeTxt.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.acti_dashboard_backToMapTxt:
Toast.makeText(getApplicationContext(), "MAin DashBoard Activity",
Toast.LENGTH_SHORT).show();
break;
case R.id.acti_dashboard_zoneTxt:
Toast.makeText(getApplicationContext(), "Zone Activity",
Toast.LENGTH_SHORT).show();
break;
case R.id.acti_dashboard_historyTxt:
Toast.makeText(getApplicationContext(), "History Activity",
Toast.LENGTH_SHORT).show();
break;
case R.id.acti_dashboard_settingTxt:
Toast.makeText(getApplicationContext(), "Settings Activity",
Toast.LENGTH_SHORT).show();
break;
case R.id.acti_dashboard_profileTxt:
Toast.makeText(getApplicationContext(), "Profile Activity",
Toast.LENGTH_SHORT).show();
break;
case R.id.acti_dashboard_newLooqiTxt:
Toast.makeText(getApplicationContext(), "Add Looqi Activity",
Toast.LENGTH_SHORT).show();
break;
case R.id.acti_dashboard_languageiTxt:
Toast.makeText(getApplicationContext(), "Language Activity",
Toast.LENGTH_SHORT).show();
break;
case R.id.acti_dashboard_unsubscribeTxt:
Toast.makeText(getApplicationContext(), "Logout Activity",
Toast.LENGTH_SHORT).show();
Intent logout_intent = new Intent(ActivityDashBoard.this,
ActivityLogOut.class);
logout_intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(logout_intent);
break;
default:
break;
}
}
答案 0 :(得分:0)
对于多项活动: - 您需要始终放置并实例化您的actionBar。 ActionBar是您活动的一部分。您可以为actionBar创建单个xml布局,并在include
中使用activity layout xml
标记。
另一部分,如果您想让actionBar
成为静态,那么只需使用一项活动并为所有fragment
创建slidingMenu's
} options。