Example usage for android.app ActionBar setBackgroundDrawable

List of usage examples for android.app ActionBar setBackgroundDrawable

Introduction

In this page you can find the example usage for android.app ActionBar setBackgroundDrawable.

Prototype

public abstract void setBackgroundDrawable(@Nullable Drawable d);

Source Link

Document

Set the ActionBar's background.

Usage

From source file:com.example.bijesh.mycollege10.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();
    //action bar color
    actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar));
    //tab color// ww  w.  j a v  a2  s  .  c  o  m
    //   actionBar.setStackedBackgroundDrawable(getResources().getDrawable(R.drawable.bluewall));
    //tab background color
    //        actionBar.setStackedBackgroundDrawable(getResources().getDrawable(
    // R.drawable.greenwall));

    // Specify that the Home/Up button should not be enabled, since there is no hierarchical
    // parent.
    actionBar.setHomeButtonEnabled(false);

    // Specify that we will be displaying tabs in the action bar.
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    // 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));
    }
}

From source file:za.ac.uct.cs.lwsjam005.eshelf.activities.ReadActivity.java

private void setupActionBar() {
    ActionBar actionBar = getActionBar();

    actionBar.setDisplayHomeAsUpEnabled(true);

    actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022")));
    actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022")));
    actionBar.setSplitBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000022")));

    actionBar.setIcon(thisBook.getIcon());
    actionBar.setTitle(thisBook.getTitle());
    actionBar.setSubtitle(thisBook.getAuthor());

}

From source file:com.burntout.burntout.SendReportActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.send_report);

    ActionBar bar = getActionBar();
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#1E5791")));
    bar.setTitle("Burnt Out");
    bar.setSubtitle("Report Burnout");
    bar.setDisplayHomeAsUpEnabled(true);

    context = this;
    SharedPreferences sharedPref = context.getSharedPreferences(getString(R.string.pref), Context.MODE_PRIVATE);

    email = sharedPref.getString("email", null);

    Log.d("email", email);

    frontText = (TextView) findViewById(R.id.frontText);
    backText = (TextView) findViewById(R.id.backText);
    reportedLightsCheck = (TextView) findViewById(R.id.reported_lights_text);
    reportPlateNumber = (EditText) findViewById(R.id.report_plate_number);
    message = (EditText) findViewById(R.id.extra_message);
    submitBtn = (Button) findViewById(R.id.report_button);
    pageMarkers = (PageMarkers) findViewById(R.id.pageMarkersReport);
    pageMarkers.setTotalPages(4);/* ww  w  . ja  v  a  2 s .com*/
    pageMarkers.makeView(0);

    statePicker = (StatePicker) findViewById(R.id.statepicker_view1);

    reportables = (TappablesHSV) findViewById(R.id.tappablesHSV1);
    reportables.setCommunicator(this);
    reportables.initItems(this);
    reportables.setFeatureItems();
    reportables.addManagers(this);

    reportPlateNumber.clearFocus();
    message.clearFocus();

    addListenerOnSubmit();

}

From source file:com.aniruddhc.acemusic.player.MusicLibraryEditorActivity.MusicLibraryEditorActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.add_to_music_library, menu);

    ActionBar actionBar = getActionBar();
    actionBar.setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
    actionBar.setIcon(// ww w .j av  a2s  .  c  o  m
            mContext.getResources().getIdentifier(libraryIconName, "drawable", mContext.getPackageName()));
    SpannableString s = new SpannableString(libraryName);
    s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    actionBar.setTitle(s);

    return super.onCreateOptionsMenu(menu);
}

From source file:com.pickr.activities.PhotosPagerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mHandler = new Handler(this);
    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_photos_pager);

    ActionBar actionBar = getActionBar();
    actionBar.setTitle(null);//from w  w  w .j  a  v a2 s . c o m
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#99333333")));

    mPager = (ViewPager) findViewById(R.id.photosPager);
    mPager.setOnPageChangeListener(this);
    mPager.setPageMargin(10);
}

From source file:com.aniruddhc.acemusic.player.BlacklistManagerActivity.BlacklistManagerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.blacklist_manager, menu);

    ActionBar actionBar = getActionBar();
    actionBar.setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext));
    SpannableString s = new SpannableString(getResources().getString(R.string.blacklist_manager));
    s.setSpan(new TypefaceSpan(this, "RobotoCondensed-Light"), 0, s.length(),
            Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    actionBar.setTitle(s);//  ww  w  . j  a v a  2s  .com

    return super.onCreateOptionsMenu(menu);
}

From source file:com.shubhangrathore.xposed.xhover.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getPreferenceManager().setSharedPreferencesMode(MODE_WORLD_READABLE);
    addPreferencesFromResource(R.xml.preferences);

    // Set status bar tinted color
    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setNavigationBarTintEnabled(true);
    tintManager.setStatusBarTintColor(getResources().getColor(R.color.material_indigo_dark));

    // Set action bar color
    ActionBar mActionBar = getActionBar();
    if (mActionBar != null) {
        mActionBar.setBackgroundDrawable(
                new ColorDrawable(getResources().getColor(R.color.material_indigo_dark)));
    }/*from   w ww  .  ja  v a  2s.  c o m*/

    // ########################################################## //

    mHideNonClearable = (CheckBoxPreference) findPreference(PREF_HIDE_NON_CLEARABLE);
    mHideLowPriority = (CheckBoxPreference) findPreference(PREF_HIDE_LOW_PRIORITY);
    mMicroFadeOutDelay = (ListPreference) findPreference(PREF_MICRO_FADE_OUT_DELAY);
    mShortFadeOutDelay = (ListPreference) findPreference(PREF_SHORT_FADE_OUT_DELAY);
    mLongFadeOutDelay = (ListPreference) findPreference(PREF_LONG_FADE_OUT_DELAY);
    mLockscreenBehavior = (ListPreference) findPreference(PREF_LOCKSCREEN_BEHAVIOR);

    mVersion = findPreference(PREF_VERSION);
    setVersionNameInGui();

    mAbout = findPreference(PREF_ABOUT);
    mApply = findPreference(PREF_APPLY);
    mChangelog = findPreference(PREF_CHANGELOG);
    mDeveloper = findPreference(PREF_DEVELOPER);
    mResetAll = findPreference(PREF_RESET_ALL);
    mSourceCode = findPreference(PREF_SOURCE_CODE);
    mTestNotification = findPreference(PREF_TEST_NOTIFICATION);
}

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);//from w ww .  ja  va2  s. 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:com.yattatech.dbtc.activity.AbstractChainTaskScreen.java

protected void setActionBar() {
    final int color = getResources().getColor(R.color.grey2);
    final ActionBar actionBar = getActionBar();
    actionBar.setIcon(R.drawable.ic_calen);
    actionBar.setTitle(R.string.app_name);
    actionBar.setBackgroundDrawable(new ColorDrawable(color));
}

From source file:com.example.swipeuiforupclose.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.profile_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./*ww w . ja v  a 2  s  . com*/
    actionBar.setHomeButtonEnabled(false);
    actionBar.setBackgroundDrawable(new ColorDrawable(0xFF46304e));
    actionBar.setStackedBackgroundDrawable(new ColorDrawable(0xFF573d5d));
    actionBar.setTitle("My Profile");

    // Specify that we will be displaying tabs in the action bar.
    //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    // 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));
    }
}