ActionBar

 actionLayout:使用

 app:actionLayout="@layout/action_layout_view"
 View edit_view=menuItem_edit.getActionView();

actionProvider:使用

        app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
        ShareActionProvider shareActionProvider= (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem_refactor);
        shareActionProvider.setShareIntent(this.getDefaultIntent());
	
private Intent getDefaultIntent() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT,""); //intent.setType("image/*"); return intent; }

选项卡模式的ActionBar的使用

 actionBar = getSupportActionBar();
         actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
	 ActionBar.Tab tab1= actionBar.newTab();
	 tab1.setIcon(R.drawable.abc_ic_commit_search_api_mtrl_alpha);
         tab1.setText("TAB1");
         tab1.setTabListener(this);
         actionBar.addTab(tab1);
	
         fragment = new BlankFragment();
         Bundle bundle = new Bundle();
         bundle.putString("content",tab.getText().toString());
         fragment.setArguments(bundle);
         ft.replace(R.id.linear,fragment);

列表模式的ActionBar的使用

ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,data);
	actionBar.setListNavigationCallbacks(adapter, new ActionBar.OnNavigationListener() {}

  

你可能感兴趣的:(ActionBar)