List of usage examples for android.app ActionBar setDisplayShowHomeEnabled
public abstract void setDisplayShowHomeEnabled(boolean showHome);
From source file:vn.cybersoft.obs.android.activities.DummyActivity.java
public void setActionBar() { ActionBar mActionBar = getActionBar(); mActionBar.setDisplayShowHomeEnabled(false); mActionBar.setDisplayShowTitleEnabled(false); LayoutInflater mInflater = LayoutInflater.from(this); View mCustomView = mInflater.inflate(R.layout.custom_actionbar, null); TextView tvAppName = (TextView) mCustomView.findViewById(R.id.tvAppName); tvAppName.setText("Droid Battery Booster"); ImageButton ivSearch = (ImageButton) mCustomView.findViewById(R.id.ivSearch); ivSearch.setOnClickListener(new OnClickListener() { @Override//from w w w. j a va 2 s . c o m public void onClick(View view) { // slide_me.toggleRightDrawer(); } }); ImageView ivdrawer = (ImageView) mCustomView.findViewById(R.id.ivdrawer); ivdrawer.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { // slide_me.toggleLeftDrawer(); if (flag) { mDrawerLayout.openDrawer(Gravity.LEFT); flag = false; } else { mDrawerLayout.closeDrawer(Gravity.LEFT); flag = true; } } }); mActionBar.setCustomView(mCustomView); mActionBar.setDisplayShowCustomEnabled(true); }
From source file:com.swisscom.safeconnect.activity.PipeActivity.java
protected void initActionBar(Activity activity, int stringId, View.OnClickListener listener) { ActionBar ab = activity.getActionBar(); //Tutorial with NoTitle Theme returns null here if (ab == null) { return;/*from w ww. java 2 s .co m*/ } ab.setDisplayShowCustomEnabled(true); ab.setDisplayShowTitleEnabled(false); ab.setDisplayShowHomeEnabled(false); actionBarView = activity.getLayoutInflater().inflate(R.layout.actionbar, null); tvTitle = (TextView) actionBarView.findViewById(R.id.tv_title); imgBackBtn = (ImageView) actionBarView.findViewById(R.id.img_back_btn); if (tvTitle != null && stringId != 0) { tvTitle.setText(stringId); } setOnBackPressedListener(listener); ab.setCustomView(actionBarView); }
From source file:com.javierd.about.AboutActivity.java
/** Called when the activity is first created. */ @Override/*ww w. j a va 2s . co m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager); setContentView(mViewPager); appContext = getApplicationContext(); ActionBar actionbar = getActionBar(); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionbar.setDisplayShowHomeEnabled(false); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.about_tab_title), AboutFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.features_tab_title), FeaturesFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.dirt_tab_title), DirtFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.contributors_tab_title), ContributorsFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.social_tab_title), SocialFragment.class, null); }
From source file:com.aogp.about.AboutActivity.java
/** Called when the activity is first created. */ @Override//from w w w.j a v a2 s. co m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.pager); setContentView(mViewPager); appContext = getApplicationContext(); ActionBar actionbar = getActionBar(); actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionbar.setDisplayShowHomeEnabled(false); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.about_tab_title), AboutFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.features_tab_title), FeaturesFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.aogp_tab_title), AOGPFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.contributors_tab_title), ContributorsFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.testers_tab_title), TestersFragment.class, null); mTabsAdapter.addTab(actionbar.newTab().setText(R.string.social_tab_title), SocialFragment.class, null); }
From source file:com.michellgaby.advsettings.DeviceSettings.java
@TargetApi(11) @Override//www. j av a 2 s. com protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new ViewPager(this); mViewPager.setId(R.id.viewPager); setContentView(mViewPager); final ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); // Remove title and icon bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowTitleEnabled(false); mTabsAdapter = new TabsAdapter(this, mViewPager); mTabsAdapter.addTab(bar.newTab().setText(R.string.general_settings_title), GeneralSettings.class, null); /** * mTabsAdapter.addTab( * bar.newTab().setText(R.string.category_mdnie_title), * mDNIeFragmentActivity.class, null); mTabsAdapter.addTab( * bar.newTab().setText(R.string.category_sensors_title), * SensorsFragmentActivity.class, null); */ mTabsAdapter.addTab(bar.newTab().setText(R.string.system_settings_title), SystemSettings.class, null); if (savedInstanceState != null) { bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); } }
From source file:com.android.talkback.tutorial.TutorialLessonFragment.java
@Override public void onResume() { super.onResume(); Activity activity = getActivity();// w w w. j a v a 2 s . c o m if (activity != null) { ActionBar actionBar = activity.getActionBar(); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setCustomView(R.layout.tutorial_action_bar); actionBar.getCustomView().findViewById(R.id.up).setOnClickListener(this); TextView title = (TextView) actionBar.getCustomView().findViewById(R.id.action_bar_title); title.setText(getTitle()); LocalBroadcastManager.getInstance(activity).registerReceiver(mActionMonitor, GestureActionMonitor.FILTER); } TalkBackService service = TalkBackService.getInstance(); if (service != null) { service.addEventListener(mExercise); } }
From source file:org.catnut.ui.PluginsActivity.java
private void injectPager(ActionBar bar, Bundle savedInstanceState) { // not show the bar, but not hide, u known what i mean? bar.setDisplayHomeAsUpEnabled(false); bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowTitleEnabled(false); setContentView(R.layout.pager);/* w w w . ja va 2 s . c o m*/ mIds = getIntent().getIntegerArrayListExtra(PLUGINS); if (savedInstanceState == null) { mIds.add(0); // add an alt one... } Collections.shuffle(mIds); // shuffle it :-) mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setOffscreenPageLimit(2); mViewPager.setPageMargin(10); mViewPager.setPageMarginDrawable(new ColorDrawable(getResources().getColor(R.color.tab_selected))); mViewPager.setAdapter(new FragmentPagerAdapter(getFragmentManager()) { @Override public Fragment getItem(int position) { Fragment fragment; switch (mIds.get(position)) { case PluginsPrefFragment.ZHIHU: fragment = ZhihuItemsFragment.getFragment(); break; case PluginsPrefFragment.FANTASY: fragment = FantasyFallFragment.getFragment(); break; default: fragment = new PlaceHolderFragment(); break; } return fragment; } @Override public int getCount() { return mIds.size(); } @Override public CharSequence getPageTitle(int position) { switch (mIds.get(position)) { case PluginsPrefFragment.ZHIHU: return getString(R.string.read_zhihu); case PluginsPrefFragment.FANTASY: return getString(R.string.fantasy); default: return "more plugins..."; } } }); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { getActionBar().setSelectedNavigationItem(position); } }); for (int i = 0; i < mViewPager.getAdapter().getCount(); i++) { bar.addTab(bar.newTab().setText(mViewPager.getAdapter().getPageTitle(i)).setTabListener(this)); } }
From source file:net.vexelon.bgrates.ui.activities.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setTitle(R.string.app_name_pure); // actionBar.setDisplayUseLogoEnabled(true); // actionBar.setLogo(R.drawable.icon); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override//w w w .j ava 2s .co m public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } // load default values PreferenceManager.setDefaultValues(this, R.xml.preferences, false); // Start Service startService(); }
From source file:htw.bui.openreskit.meter.SeriesActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mOverlayFramelayout = new FrameLayout(this); setContentView(mOverlayFramelayout); View view = getLayoutInflater().inflate(R.layout.series_fragment, mOverlayFramelayout, false); mOverlayFramelayout.addView(view);/*from w w w . j a v a 2 s. c o m*/ mContext = this; mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false); if (Utils.isTablet(this)) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE); } else { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT); } ActionBar bar = getActionBar(); bar.setDisplayOptions( ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayShowHomeEnabled(true); EnterValueFragment enterValueFrag = (EnterValueFragment) mFragMan .findFragmentById(R.id.enter_value_fragment); if (enterValueFrag != null) { enterValueFrag.getView().setVisibility(View.INVISIBLE); } }
From source file:edu.ufl.cise.android.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Create the adapter that will return a fragment for each of the three primary sections // of the app. mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent.// w w w .ja v a2 s.c o m actionBar.setHomeButtonEnabled(false); // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayUseLogoEnabled(false); // Set up the ViewPager, attaching the adapter and setting up a listener for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between different app sections, select the corresponding tab. // We can also use ActionBar.Tab#select() to do this if we have a reference to the // Tab. actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by the adapter. // Also specify this Activity object, which implements the TabListener interface, as the // listener for when this tab is selected. actionBar.addTab( actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }