List of usage examples for android.app ActionBar setIcon
public abstract void setIcon(Drawable icon);
From source file:com.hkm.oc.wv.supportwebview.webviewSupports.java
protected void extra_action_bar_settings() { ActionBar ab = getActionBar(); ab.setDisplayShowTitleEnabled(false); ab.setIcon(null); }
From source file:com.techsoc.cultureconnect.navigation.NavigationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nav_main_activity); mTitle = mDrawerTitle = "";//getTitle(); mOptions = getResources().getStringArray(R.array.options); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerListLeft = (ListView) findViewById(R.id.left_drawer); // set a custom shadow that overlays the main content when the drawer opens mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); // set up the drawer's list view with items and click listener mDrawerListLeft.setAdapter(new ArrayAdapter<String>(this, R.layout.nav_drawer_list_item, mOptions)); mDrawerListLeft.setOnItemClickListener(new DrawerItemClickListener()); ActionBar actionBar = getActionBar(); actionBar.setIcon(R.drawable.culture_connect_white); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.CultureConnect))); actionBar.setTitle(null);//w w w . j av a 2s . c o m // enable ActionBar app icon to behave as action to toggle nav drawer actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); // ActionBarDrawerToggle ties together the the proper interactions // between the sliding drawer and the action bar app icon mDrawerToggleLeft = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } public void onDrawerOpened(View drawerView) { getActionBar().setTitle(mDrawerTitle); invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggleLeft); if (savedInstanceState == null) { selectItem(0); } }
From source file:org.segin.ttleditor.SettingsActivity.java
/** * Shows the simplified settings UI if the device configuration if the * device configuration dictates that a simplified, single-pane UI should be * shown./*from w w w .j a v a2 s.c o m*/ */ private void setupSimplePreferencesScreen() { if (!isSimplePreferences(this)) { return; } ActionBar actionBar = getActionBar(); try { actionBar.setIcon(getResources().getDrawable(R.drawable.ic_settings)); } catch (Exception e) { e.printStackTrace(); } // In the simplified UI, fragments are not used at all and we instead // use the older PreferenceActivity APIs. // Add 'general' preferences. addPreferencesFromResource(R.xml.pref_general); // Add 'notifications' preferences, and a corresponding header. PreferenceCategory fakeHeader = new PreferenceCategory(this); fakeHeader.setTitle(R.string.pref_header_debug); getPreferenceScreen().addPreference(fakeHeader); addPreferencesFromResource(R.xml.pref_debug); // Bind the summaries of EditText/List/Dialog/Ringtone preferences to // their values. When their values change, their summaries are updated // to reflect the new value, per the Android Design guidelines. bindPreferenceSummaryToValue(findPreference("iface")); bindPreferenceSummaryToValue(findPreference("ttl")); Preference sharePref = (Preference) findPreference("share"); sharePref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text)); sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_subject)); sendIntent.setType("text/plain"); startActivity(sendIntent); return true; } }); }
From source file:org.catnut.fragment.MentionTimelineFragment.java
@Override public void onStart() { super.onStart(); ActionBar bar = getActivity().getActionBar(); bar.setIcon(R.drawable.ic_stat_mention); bar.setTitle(getString(R.string.mention_me_timeline)); }
From source file:org.catnut.fragment.HomeTimelineFragment.java
@Override public void onStart() { super.onStart(); ActionBar bar = getActivity().getActionBar(); bar.setIcon(R.drawable.ic_title_home); bar.setTitle(getString(R.string.home_timeline)); }
From source file:com.battlelancer.seriesguide.ui.FullscreenImageActivity.java
private void setupActionBar() { final ActionBar actionBar = getActionBar(); actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.background_actionbar_gradient)); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setIcon(R.drawable.ic_actionbar); actionBar.setDisplayShowTitleEnabled(false); }
From source file:com.lx.minimusic.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getActionBar(); actionBar.setTitle("?"); actionBar.setIcon(R.mipmap.app_logo2); mMyMusicFragment = MyMusicFragment.newInstance(); mApplication = (MiniMusicApplication) getApplication(); tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs); pager = (ViewPager) findViewById(R.id.pager); adapter = new MyPagerAdapter(getSupportFragmentManager()); pager.setAdapter(adapter);/*from w ww . java2s .c o m*/ final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources().getDisplayMetrics()); pager.setPageMargin(pageMargin); tabs.setViewPager(pager); changeColor(currentColor); }
From source file:org.catnut.fragment.FavoriteFragment.java
@Override public void onStart() { super.onStart(); ActionBar actionBar = getActivity().getActionBar(); actionBar.setTitle(getString(R.string.my_favorites)); actionBar.setIcon(R.drawable.ic_title_favorite); }
From source file:com.aboveware.actionbar.honeycomb.ActionBarHelperHoneycomb.java
@Override public void setIcon(int icon) { ActionBar bar = mActivity.getActionBar(); bar.setIcon(icon); }
From source file:org.catnut.fragment.UserTimelineFragment.java
@Override public void onStart() { super.onStart(); ActionBar bar = getActivity().getActionBar(); bar.setIcon(R.drawable.ic_title_list); bar.setTitle(mIsMe ? getString(R.string.my_timeline) : getString(R.string.his_timeline, mScreenName)); }