android.app.ActionBar#setDisplayShowTitleEnabled ( )源码实例Demo

下面列出了android.app.ActionBar#setDisplayShowTitleEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: codeexamples-android   文件: MainActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	// setup action bar for tabs
	ActionBar actionBar = getActionBar();
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
	actionBar.setDisplayShowTitleEnabled(false);

	Tab tab = actionBar
			.newTab()
			.setText("First tab")
			.setTabListener(
					new MyTabListener<DetailFragment>(this, "artist",
							DetailFragment.class));
	actionBar.addTab(tab);

	tab = actionBar
			.newTab()
			.setText("Second Tab")
			.setTabListener(
					new MyTabListener<ImageFragment>(this, "album",
							ImageFragment.class));
	actionBar.addTab(tab);

}
 
源代码2 项目: codeexamples-android   文件: MainActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if(savedInstanceState != null) {
        if (savedInstanceState.getInt("theme", -1) != -1) {
          mThemeId = savedInstanceState.getInt("theme");
          this.setTheme(mThemeId);
        }
        mTitlesHidden = savedInstanceState.getBoolean("titlesHidden");
    }

    setContentView(R.layout.main);

    ActionBar bar = getActionBar();
    bar.setDisplayShowTitleEnabled(false);

    ContentFragment frag = (ContentFragment) getFragmentManager()
            .findFragmentById(R.id.content_frag);
    if (frag != null) mDualFragments = true;
    
    if (mTitlesHidden) {
        getFragmentManager().beginTransaction()
                .hide(getFragmentManager().findFragmentById(R.id.titles_frag)).commit();
    }
}
 
源代码3 项目: FreezeYou   文件: FullScreenImageViewerActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    ThemeUtils.processSetTheme(this);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fsiva_main);
    ActionBar actionBar = getActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
    Intent intent = getIntent();
    if (intent != null) {
        ImageView fsiva_main_imageView = findViewById(R.id.fsiva_main_imageView);
        fsiva_main_imageView.setImageBitmap(
                BitmapFactory.decodeFile(intent.getStringExtra("imgPath"))
        );
        fsiva_main_imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    } else {
        finish();
    }

}
 
源代码4 项目: kylewbanks.com-AndroidApp   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //Customize the action bar
    ActionBar actionBar = getActionBar();
    if(actionBar != null) {
        actionBar.setDisplayShowHomeEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);

        LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = inflater.inflate(R.layout.header, null);

        Typeface scriptFont = Typeface.createFromAsset(getAssets(), "fonts/script.ttf");
        TextView title = (TextView) v.findViewById(R.id.title);
        title.setTypeface(scriptFont);

        actionBar.setCustomView(v);
    }

    //Initialize Views
    postListView = (AnimatedListView) findViewById(R.id.post_list);
    postListView.setOnItemClickListener(postItemSelectedListener);


    progressBar = (ProgressBar) findViewById(R.id.loader);

    //Register as a Post List update listener
    KWBApplication application = (KWBApplication) getApplication();
    application.registerPostUpdateListener(this);
}
 
源代码5 项目: Noyze   文件: HelpActivity.java
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      popup(this);
      mPager = new ViewPager(this);
      mPager.setId(R.id.pager);
      setContentView(mPager);
      
      // Set up our ActionBar
      final ActionBar mAB = getActionBar();
      if (null != mAB) {
          // Create a Spannable for a custom font face in the title.
          SpannableString title = new SpannableString(getString(R.string.welcome_to));
          title.setSpan(new TypefaceSpan(this, "TimeBurner_Regular.ttf"), 0, title.length(),
                  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

          mAB.setTitle(title);
          mAB.setDisplayShowTitleEnabled(true);
          mAB.setDisplayHomeAsUpEnabled(true);
      }

// Set our Adapter for the Pager.
      mAdapter = new HelpFragmentAdapter(this);
      mPager.setAdapter(mAdapter);
      
      // We have to add the listener here, because CirclePageIndicator
      // uses the default listener to know when to change state.
      mPager.setOnPageChangeListener(this);
      
      // Save the last/ current item.
      if (savedInstanceState != null && savedInstanceState.containsKey(KEY_POSITION)) {
      	mPager.setCurrentItem(savedInstanceState.getInt(KEY_POSITION));
      }
  }
 
源代码6 项目: MultiSlider   文件: NavigationDrawerFragment.java
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
源代码7 项目: weixin   文件: UserDetailedInfoActivity.java
private void initView() {
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayHomeAsUpEnabled(true);
	actionBar.setDisplayShowHomeEnabled(false);
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.text_menu_userDetailedInfo_title);
	setOverflowShowingAlways();

	mIv_userPhoto = (ImageView) findViewById(R.id.cgt_iv_userDetailedInfo_userPhoto);
	mTv_userName = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_userName);
	mIv_userSex = (ImageView) findViewById(R.id.cgt_iv_userDetailedInfo_userSex);
	mTv_userWeixin = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_userWeixin);
	mTv_nickName = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_nickname);
	mTv_area = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_area);
	mTv_personalizedSignature = (TextView) findViewById(R.id.cgt_tv_userDetailedInfo_personalizedSignature);
	mLl_personalPhoto_box = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_personalPhoto_box);
	mLl_personalPhoto = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_personalPhoto);
	mLl_socialInfo_box = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_socialInfo_box);
	mLl_socialInfo = (LinearLayout) findViewById(R.id.cgt_ll_userDetailedInfo_socialInfo);
	mBtn_sendMsg = (Button) findViewById(R.id.cgt_btn_userDetailedInfo_sendMsg);
	mBtn_videoChat = (Button) findViewById(R.id.cgt_btn_userDetailedInfo_videoChat);

	mIv_userPhoto.setOnClickListener(this);
	mLl_personalPhoto_box.setOnClickListener(this);
	mLl_socialInfo_box.setOnClickListener(this);
	mBtn_sendMsg.setOnClickListener(this);
	mBtn_videoChat.setOnClickListener(this);
}
 
源代码8 项目: CameraV   文件: PreferencesActivity.java
@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setTitle(R.string.preferences);
		
		ActionBar actionBar = getActionBar();
		actionBar.setDisplayShowTitleEnabled(true);
		actionBar.setDisplayShowHomeEnabled(true);
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setHomeButtonEnabled(true);
		actionBar.setLogo(this.getResources().getDrawable(R.drawable.ic_action_up));
		actionBar.setDisplayUseLogoEnabled(true);
		
		addPreferencesFromResource(R.xml.preferences);
		
//		lockScreenMode = (ListPreference) findPreference(Preferences.Keys.LOCK_SCREEN_MODE);
//		updateSummaryWithChoice(lockScreenMode, lockScreenMode.getValue(), getResources().getStringArray(R.array.lockScreenOptions_));

		language = (ListPreference) findPreference(Preferences.Keys.LANGUAGE);
		updateSummaryWithChoice(language, language.getValue(), getResources().getStringArray(R.array.languages_));
		
		//originalImage = (ListPreference) findPreference(Models.IUser.ASSET_ENCRYPTION);
		//updateSummaryWithChoice(originalImage, originalImage.getValue(), getResources().getStringArray(R.array.originalImageOptions_));

		panicAction = (ListPreference) findPreference(Preferences.Keys.PANIC_ACTION);
		updateSummaryWithChoice(panicAction, panicAction.getValue(), getResources().getStringArray(R.array.panicActionOptions_));
	}
 
源代码9 项目: CameraV   文件: HomeActivity.java
private void resetActionBar()
{
	ActionBar actionBar = getActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.app_name);
	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(false);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setIcon(R.mipmap.ic_launcher);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 
源代码10 项目: UltimateAndroid   文件: NavigationDrawerFragment.java
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
源代码11 项目: CameraV   文件: GalleryFragment.java
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
	super.onCreateOptionsMenu(menu, inflater);
	inflater.inflate(R.menu.activity_home_gallery, menu);

	MenuItem menuFilter = menu.findItem(R.id.menu_filter);
	Spinner spinner = (Spinner) menuFilter.getActionView();
	GalleryFilterAdapter spinnerAdapter = new GalleryFilterAdapter(spinner.getContext(), this.getResources().getTextArray(R.array.filter_options));
	spinner.setAdapter(spinnerAdapter);
	spinner.setOnItemSelectedListener(this);
	
	mMenuItemBatchOperations = menu.findItem(R.id.menu_select);
	
	miDropbox = menu.findItem(R.id.menu_remote_access_dropbox);
	DropboxSyncManager dsm = DropboxSyncManager.getInstance(a);
	if (dsm != null && dsm.isSyncing())
		miDropbox.setChecked(true);
	
	ActionBar actionBar = getActivity().getActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
	actionBar.setTitle(R.string.home_gallery_title);
	actionBar.setDisplayShowHomeEnabled(true);
	actionBar.setDisplayHomeAsUpEnabled(false);
	actionBar.setHomeButtonEnabled(true);
	actionBar.setLogo(this.getResources().getDrawable(
			R.drawable.ic_action_up));
	actionBar.setDisplayUseLogoEnabled(true);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 
源代码12 项目: UltimateAndroid   文件: NavigationDrawerFragment.java
/**
 * Per the navigation drawer design guidelines, updates the action bar to show the global app
 * 'context', rather than just what's in the current screen.
 */
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
源代码13 项目: Noyze   文件: ConfigurationActivity.java
public static void setupActionBar(Activity activity) {

        // Tint the status bar, if available.
        SystemBarTintManager tintManager = new SystemBarTintManager(activity);
        tintManager.setStatusBarTintEnabled(true);
        tintManager.setTintColor(activity.getResources().getColor(R.color.action_bar_dark));

        ActionBar actionBar = activity.getActionBar();
        if (null != actionBar) {
            actionBar.setIcon(DateUtils.AppIcon());
            actionBar.setDisplayHomeAsUpEnabled(!activity.isTaskRoot());
            actionBar.setDisplayShowTitleEnabled(true);
        }
    }
 
源代码14 项目: Noyze   文件: HelpActivity.java
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

      popup(this);
      mPager = new ViewPager(this);
      mPager.setId(R.id.pager);
      setContentView(mPager);
      
      // Set up our ActionBar
      final ActionBar mAB = getActionBar();
      if (null != mAB) {
          // Create a Spannable for a custom font face in the title.
          SpannableString title = new SpannableString(getString(R.string.welcome_to));
          title.setSpan(new TypefaceSpan(this, "TimeBurner_Regular.ttf"), 0, title.length(),
                  Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

          mAB.setTitle(title);
          mAB.setDisplayShowTitleEnabled(true);
          mAB.setDisplayHomeAsUpEnabled(true);
      }

// Set our Adapter for the Pager.
      mAdapter = new HelpFragmentAdapter(this);
      mPager.setAdapter(mAdapter);
      
      // We have to add the listener here, because CirclePageIndicator
      // uses the default listener to know when to change state.
      mPager.setOnPageChangeListener(this);
      
      // Save the last/ current item.
      if (savedInstanceState != null && savedInstanceState.containsKey(KEY_POSITION)) {
      	mPager.setCurrentItem(savedInstanceState.getInt(KEY_POSITION));
      }
  }
 
源代码15 项目: chromium-webview-samples   文件: MainActivity.java
public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
源代码16 项目: mobile-manager-tool   文件: MusicLibrary.java
/**
 * For the theme chooser
 */
private void initActionBar() {
	ActionBar actBar = getActionBar();
	actBar.setDisplayUseLogoEnabled(true);
    actBar.setDisplayShowTitleEnabled(false);
}
 
源代码17 项目: Onosendai   文件: MainActivity.java
@Override
protected void onCreate (final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	this.prefs = new Prefs(getBaseContext());
	if (!this.prefs.isConfigured()) {
		startActivity(new Intent(getApplicationContext(), SetupActivity.class));
		finish();
		return;
	}
	this.prefs.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

	requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
	setContentView(R.layout.activity_main);

	try {
		this.conf = this.prefs.asConfig();
	}
	catch (final Exception e) { // No point continuing if any exception.
		LOG.wtf("Unparsable config.", e);
		DialogHelper.alertAndClose(this, e);
		return;
	}

	this.imageCache = new HybridBitmapCache(this, C.MAX_MEMORY_IMAGE_CACHE);

	if (this.prefs.getSharedPreferences().getBoolean(AdvancedPrefFragment.KEY_THREAD_INSPECTOR, false)) {
		final TextView jobStatus = (TextView) findViewById(R.id.jobStatus);
		jobStatus.setVisibility(View.VISIBLE);
		this.executorStatus = new ExecutorStatus(jobStatus);
	}

	this.localEs = ExecUtils.newBoundedCachedThreadPool(C.LOCAL_MAX_THREADS, new LogWrapper("LES"), this.executorStatus);
	this.netEs = ExecUtils.newBoundedCachedThreadPool(C.NET_MAX_THREADS, new LogWrapper("NES"), this.executorStatus);
	this.msgHandler = new MessageHandler(this);

	final float columnWidth = UiPrefFragment.readColumnWidth(this, this.prefs);
	this.columnsRtl = UiPrefFragment.readColumnsRtl(this.prefs);

	// If this becomes too memory intensive, switch to android.support.v4.app.FragmentStatePagerAdapter.
	final SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(), this, columnWidth);
	this.viewPager = (SidebarAwareViewPager) findViewById(R.id.pager);
	this.pageSelectionListener = new VisiblePageSelectionListener(columnWidth);
	final MultiplexingOnPageChangeListener onPageChangeListener = new MultiplexingOnPageChangeListener(
			this.pageSelectionListener,
			new NotificationClearingPageSelectionListener(this));
	this.viewPager.setOnPageChangeListener(onPageChangeListener);
	this.viewPager.setAdapter(sectionsPagerAdapter);
	if (!showPageFromIntent(getIntent())) {
		if (this.columnsRtl) {
			gotoPage(0);
		}
		else {
			onPageChangeListener.onPageSelected(this.viewPager.getCurrentItem());
		}
	}

	final ActionBar ab = getActionBar();
	ab.setDisplayShowHomeEnabled(true);
	ab.setHomeButtonEnabled(true);
	ab.setDisplayShowTitleEnabled(false);
	ab.setDisplayShowCustomEnabled(true);

	this.columnTitleStrip = new ColumnTitleStrip(ab.getThemedContext());
	this.columnTitleStrip.setViewPager(this.viewPager);
	this.columnTitleStrip.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	this.columnTitleStrip.setColumnClickListener(new TitleClickListener(this));
	ab.setCustomView(this.columnTitleStrip);

	AlarmReceiver.configureAlarms(this);
	new CheckBackgroundUpdatesRunning(this, this.executorStatus).executeOnExecutor(this.localEs);
}
 
源代码18 项目: AndrOBD   文件: ChartActivity.java
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
	getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
	                     WindowManager.LayoutParams.FLAG_FULLSCREEN);

	// keep main display on?
	if(MainActivity.prefs.getBoolean("keep_screen_on", false))
	{
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	}

	// prevent activity from falling asleep
	PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
	wakeLock = Objects.requireNonNull(powerManager).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
		getString(R.string.app_name));
	wakeLock.acquire();

	// set up action bar
	ActionBar actionBar = getActionBar();
	if (actionBar != null)
	{
		actionBar.setDisplayShowTitleEnabled(true);
	}

	setTitle(R.string.chart);

	/* get PIDs to be shown */
	int positions[] = getIntent().getIntArrayExtra(POSITIONS);

	// set up overall chart properties
	sensorData = new XYMultipleSeriesDataset();
	renderer = new XYMultipleSeriesRenderer(positions.length);
	chartView = ChartFactory.getTimeChartView(this, sensorData, renderer, "H:mm:ss");
	// set up global renderer
	renderer.setXTitle(getString(R.string.time));
	renderer.setXLabels(5);
	renderer.setYLabels(5);
	renderer.setGridColor(Color.DKGRAY);
	renderer.setShowGrid(true);
	renderer.setFitLegend(true);
	renderer.setClickEnabled(false);
	// set up chart data
	setUpChartData(positions);
	// make chart visible
	setContentView(chartView);
	// limit selected PIDs to selection
	MainActivity.setFixedPids(pidNumbers);
	// if auto hiding selected ...
	if(MainActivity.prefs.getBoolean(MainActivity.PREF_AUTOHIDE,false))
	{
		// get autohide timeout [s]
		int timeout = Integer.valueOf(
			MainActivity.prefs.getString(MainActivity.PREF_AUTOHIDE_DELAY,"15") );
		// auto hide toolbar
		toolBarHider = new AutoHider( this,
		                              mHandler,
			timeout * 1000);
		toolBarHider.start(1000);
		// wake up on touch
		chartView.setOnTouchListener(toolBarHider);
	}
}
 
源代码19 项目: xDrip   文件: NavigationDrawerFragment.java
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
public void restoreActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}