List of usage examples for android.app Activity getActionBar
@Nullable
public ActionBar getActionBar()
From source file:Main.java
public static void setDisplayHomeAsUpEnabled(Activity activity, boolean b) { ActionBar actionBar = activity.getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(b); }//from w w w.j av a2 s .c om }
From source file:Main.java
public static void setupActionBarDisplayUp(Activity activity) { setupActionBar(activity);//from w ww .j a v a2s .c om activity.getActionBar().setDisplayHomeAsUpEnabled(true); }
From source file:Main.java
public static void hide(Activity act) { ActionBar actionBar = act.getActionBar(); if (actionBar != null) actionBar.hide();//from w w w . ja va2s . c o m }
From source file:Main.java
@SuppressLint("NewApi") @SuppressWarnings("deprecation") public static void setBackground(Activity activity, int background) { activity.getActionBar() .setIcon(new ColorDrawable(activity.getResources().getColor(android.R.color.transparent))); Drawable draw;/*from ww w. j a v a 2 s . co m*/ if (android.os.Build.VERSION.SDK_INT >= 21) { draw = activity.getResources().getDrawable(background, activity.getTheme()); activity.getActionBar().setBackgroundDrawable(draw); } else { draw = activity.getResources().getDrawable(background); activity.getActionBar().setBackgroundDrawable(draw); } }
From source file:Main.java
/** * Set action bar background// w w w . j a v a2 s . c o m * * @param activity The activity to set ActionBar background to. * @param resColorId The Drawable color to set the ActionBar to. */ public static void setActionBarBackground(Activity activity, int resColorId) { // change action bar color activity.getActionBar() .setBackgroundDrawable(new ColorDrawable(activity.getResources().getInteger(resColorId))); activity.getActionBar().setDisplayShowTitleEnabled(false); activity.getActionBar().setDisplayShowTitleEnabled(true); }
From source file:Main.java
public static boolean setDisplayShowTitleEnabled(Activity act, boolean b) { ActionBar actionBar = act.getActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(b); return true; } else {/*from w ww . ja va2s . c om*/ return false; } }
From source file:Main.java
/** * Set the action bar to stop displaying the application icon * * @param activity The current Activity// www. j a va2s. com */ public static void setActionBarNoIcon(Activity activity) { // remove the icon from the actionbar ActionBar actionBar = activity.getActionBar(); if (actionBar != null) { activity.getActionBar().setDisplayShowHomeEnabled(false); } }
From source file:Main.java
public static boolean setDisplayHomeAsUpEnabled(Activity act, boolean state) { ActionBar actionBar = act.getActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(state); return true; } else {/*from ww w .ja v a2s .c om*/ return false; } }
From source file:Main.java
@SuppressWarnings("deprecation") @SuppressLint("NewApi") public static void setActionBar(Activity activity, int background) { // Action Bar Icon activity.getActionBar() .setIcon(new ColorDrawable(activity.getResources().getColor(android.R.color.transparent))); // Action Bar Background Drawable draw;// w w w . j a v a 2 s . c o m if (android.os.Build.VERSION.SDK_INT >= 21) { draw = activity.getResources().getDrawable(background, activity.getTheme()); activity.getActionBar().setBackgroundDrawable(draw); } else { draw = activity.getResources().getDrawable(background); activity.getActionBar().setBackgroundDrawable(draw); } }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public static void setupStandardActionBar(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { activity.getActionBar().setDisplayHomeAsUpEnabled(true); }/* w w w .ja v a 2s . c o m*/ }