@Override public void onStart() { super.onStart(); final ActionBar bar = getActivity().getActionBar(); mPreviousTitle = bar.getTitle(); bar.setTitle(R.string.gesture_anywhere_title); }
@Kroll.method @Kroll.getProperty public String getTitle() { if (actionBar == null) { return null; } return (String) actionBar.getTitle(); }
private void setTitle(CharSequence title) { if (!TextUtils.equals(title, mActionBar.getTitle())) { mActionBar.setTitle(title); } if (mLegacyTitle != null) { mLegacyTitle.setText(title); } }
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActionBar actionBar = getActionBar(); // actionBar.setDisplayHomeAsUpEnabled(true); setContentView(R.layout.tsquare_main); overridePendingTransition(R.anim.fade, R.anim.hold); EasyTracker.getInstance(this).activityStart(this); GoogleAnalytics.getInstance(this).getTracker(MainActivity.TRACKING); Tracker tracker = GoogleAnalytics.getInstance(this).getTracker(MainActivity.TRACKING); tracker.send( MapBuilder.createAppView() .set(Fields.SCREEN_NAME, "T-Square Final " + actionBar.getTitle()) .build()); }
/** * 改变标题字体 @Title: changeTitleFonts * * @param activity * @param typeface */ public static void changeTitleFonts(Activity activity, Typeface typeface) { if (typeface == null || activity == null) { Log.e(TAG, "activity或 typeface等于空!"); return; } if (activity instanceof ActionBarActivity) { try { android.support.v7.app.ActionBar actionBar = ((ActionBarActivity) activity).getSupportActionBar(); setTitle(actionBar, typeface, actionBar.getTitle().toString()); } catch (Exception e) { Log.e(TAG, e.toString()); } } else if (activity instanceof Activity) { try { ActionBar actionBar = activity.getActionBar(); setTitle(actionBar, typeface, actionBar.getTitle().toString()); } catch (Exception e) { Log.e(TAG, e.toString()); } } }
@Override public CharSequence getTitle() { return mActionBar.getTitle(); }