Java Code Examples for android.support.v7.app.ActionBar#setDisplayShowTitleEnabled()

The following examples show how to use android.support.v7.app.ActionBar#setDisplayShowTitleEnabled() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: ByWebView   File: ByWebViewActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void initToolBar() {
    // 可滚动的title 使用简单 没有渐变效果,文字两旁有阴影
    Toolbar mTitleToolBar = findViewById(R.id.title_tool_bar);
    tvGunTitle = findViewById(R.id.tv_gun_title);
    setSupportActionBar(mTitleToolBar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        //去除默认Title显示
        actionBar.setDisplayShowTitleEnabled(false);
    }
    mTitleToolBar.setOverflowIcon(ContextCompat.getDrawable(this, R.drawable.actionbar_more));
    tvGunTitle.postDelayed(new Runnable() {
        @Override
        public void run() {
            tvGunTitle.setSelected(true);
        }
    }, 1900);
    tvGunTitle.setText(mTitle);
}
 
Example 2
/**
 * Actionbar Spinner handler
 */

public void setHasActionBarSpinner(Boolean hasActionBarSpinner) {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        Spinner spinner = (Spinner) findViewById(R.id.spinner_nav);
        if (hasActionBarSpinner) {
            if (spinner != null)
                spinner.setVisibility(View.VISIBLE);
            actionBar.setDisplayShowTitleEnabled(false);
        } else {
            if (spinner != null)
                spinner.setVisibility(View.GONE);
            actionBar.setDisplayShowTitleEnabled(true);
        }
        mHasActionBarSpinner = hasActionBarSpinner;
    }
}
 
Example 3
@SuppressLint( "SetTextI18n" )
@Override
public void setupView(){
    int itemSpace = (int) getResources().getDimension( R.dimen.default_padding_margin_large );
    rvOrder.addItemDecoration( new LinearLayoutMargin( itemSpace ) );
    rvOrder.setLayoutManager( new LinearLayoutManager( this ) );
    rvOrder.setAdapter( orderAdapter );
    btnClose.setOnClickListener( onClickBack() );
    btnBack.setOnClickListener( onClickBack() );

    setSupportActionBar( toolbar );
    ActionBar actionbar = getSupportActionBar();
    if( actionbar != null ){
        actionbar.setDisplayHomeAsUpEnabled( false );
        actionbar.setDisplayShowTitleEnabled( false );
    }

    tvDate.setText( item.getDate() + StringUtils.getAtString(this) + item.getTime() );
    tvTotalPrice.setText( StringUtils.getCommaPriceWithBaht( this, item.getTotalPrice() ) );
}
 
Example 4
/**
 * 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);
}
 
Example 5
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mTitle);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setIcon(R.drawable.ic_launcher_transparent);
    }
}
 
Example 6
@Override
public void initToolbar() {
    setSupportActionBar(mCommonToolbar);
    mToolbarTitle.setText(getString(R.string.person_collection));
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(false);//不使用原始的toolbar的title
    }
    mCommonToolbar.setNavigationOnClickListener(v -> {
        //如果有进行取消收藏的操作,退出时将更新文章
        if (isUnCollect) RxBus.getInstance().post(new AutoRefreshEvent(true));
        finish();
    });
}
 
Example 7
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    currentThemeIsDark = App.get().isDarkTheme();
    setTheme(currentThemeIsDark ? R.style.PreferenceAppThemeDark : R.style.PreferenceAppThemeLight);
    setContentView(R.layout.activity_settings);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(R.string.activity_title_settings);
    }
    PreferenceFragmentCompat fragment = null;
    Intent intent = getIntent();
    if (intent != null) {
        String settingsArgument = intent.getStringExtra(ARG_NEW_PREFERENCE_SCREEN);
        if (settingsArgument != null) {
            if (settingsArgument.equals(NotificationsSettingsFragment.PREFERENCE_SCREEN_NAME)) {
                fragment = new NotificationsSettingsFragment();
            }
        }
    }
    if (fragment == null) {
        fragment = new SettingsFragment();
    }

    getSupportFragmentManager().beginTransaction().replace(R.id.fragment_content, fragment).commit();

    /*View view = findViewById(R.id.fragment_content);
    view.setBackgroundColor(Color.TRANSPARENT);
    view.setBackgroundColor(Color.rgb(4, 26, 55));*/

    App.get().addPreferenceChangeObserver(appThemeChangeObserver);
}
 
Example 8
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    text = getIntent().getStringExtra("source_code");

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setDisplayShowCustomEnabled(false);

    actionBar.setTitle("Code Preview");

    WebView webView = new WebView(this);
    webView.getSettings().setJavaScriptEnabled(true);

    String data = "<html>\n" +
            "<header>\n" +
            "<link rel=\"stylesheet\" href=\"highlight-default.min.css\">\n" +
            "<script src=\"highlight.min.js\"></script>\n" +
            "<script>hljs.initHighlightingOnLoad();</script>\n" +
            "</header>\n" +
            "<body>\n" +
            "<pre><code>" +
            text.replace("&", "&amp;")
                    .replace("<", "&lt;")
                    .replace(">", "&gt;")
                    .replace("\"", "&quot;")
                    .replace("\n", "<br/>")
            + "</code></pre>" +
            "</body>\n" +
            "</html>";

    webView.loadDataWithBaseURL("file:///android_asset/", data, "text/html", "utf-8", "");

    setContentView(webView);
}
 
Example 9
Source Project: android-player   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void initDrawerLayout() {
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final ActionBar supportActionBar = getSupportActionBar();
    final DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.activityMainDrawerLayout);
    final ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.abc_toolbar_collapse_description,
            R.string.abc_toolbar_collapse_description);
    drawerToggle.setDrawerIndicatorEnabled(true);
    supportActionBar.setDisplayHomeAsUpEnabled(true);
    supportActionBar.setHomeButtonEnabled(true);
    supportActionBar.setDisplayShowTitleEnabled(false);
    drawerToggle.syncState();
    drawerLayout.setDrawerListener(drawerToggle);
}
 
Example 10
Source Project: px-android   File: SummaryView.java    License: MIT License 5 votes vote down vote up
public void configureToolbar(@NonNull final AppCompatActivity activity,
    @NonNull final View.OnClickListener listener) {
    final Toolbar toolbar = findViewById(R.id.toolbar);
    activity.setSupportActionBar(toolbar);

    final ActionBar actionBar = activity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setHomeActionContentDescription(R.string.px_label_back);
    }
    toolbar.setNavigationOnClickListener(listener);
}
 
Example 11
Source Project: Yahala-Messenger   File: MainActivity.java    License: MIT License 5 votes vote down vote up
@Override
public void applySelfActionBar() {
    try {
        if (parentActivity == null) {
            return;
        }
        final ActionBar actionBar = parentActivity.getSupportActionBar();
        //  actionBar.hide();
        //ImageView view = (ImageView) fragmentView.findViewById(16908332);
        // if (view == null) {
        ImageView view = (ImageView) fragmentView.findViewById(R.id.home);
        // }
        if (view != null) {
            view.setPadding(OSUtilities.dp(6), 0, OSUtilities.dp(6), 0);
        }
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setDisplayUseLogoEnabled(false);

        actionBar.setCustomView(null);
        actionBar.setSubtitle(null);
        actionBar.setTitle(LocaleController.getString("AppName", R.string.AppName));

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 12
Source Project: DanDanPlayForAndroid   File: MainActivity.java    License: MIT License 5 votes vote down vote up
@Override
public void initView() {
    if (hasBackActionbar() && getSupportActionBar() != null) {
        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(false);
        actionBar.setDisplayShowTitleEnabled(true);
    }
    setTitle("媒体库");
    navigationView.setSelectedItemId(R.id.navigation_play);
    switchFragment(PlayFragment.class);

    initPermission();
}
 
Example 13
Source Project: droidkaigi2016   File: WebViewActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void initToolbar(@NonNull String title) {
    setSupportActionBar(binding.toolbar);

    ActionBar bar = getSupportActionBar();
    if (bar != null) {
        bar.setDisplayHomeAsUpEnabled(true);
        bar.setDisplayShowHomeEnabled(true);
        bar.setDisplayShowTitleEnabled(false);
        bar.setHomeButtonEnabled(true);
    }
    binding.toolbar.setTitle(title);
}
 
Example 14
Source Project: px-android   File: SecurityCodeActivity.java    License: MIT License 5 votes vote down vote up
private void initializeToolbar() {
    mToolbar = findViewById(R.id.mpsdkToolbar);
    setSupportActionBar(mToolbar);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setHomeActionContentDescription(R.string.px_label_back);
    }
    mToolbar.setNavigationOnClickListener(v -> onBackPressed());
}
 
Example 15
/**
 * 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);
}
 
Example 16
@CallSuper
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Initialize the associated SharedPreferences file with default values
    // for each preference when the user first opens your application.
    // When false, the system sets the default values only if this method has
    // never been called in the past (or the KEY_HAS_SET_DEFAULT_VALUES in the
    // default value shared preferences file is false).
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    // ========================================================================================
    // TOneverDO: Set theme after setContentView()
    final String themeDark = getString(R.string.theme_dark);
    final String themeBlack = getString(R.string.theme_black);
    String theme = PreferenceManager.getDefaultSharedPreferences(this).getString(
            getString(R.string.key_theme), null);
    if (themeDark.equals(theme)) {
        setTheme(R.style.AppTheme_Dark);
    } else if (themeBlack.equals(theme)) {
        setTheme(R.style.AppTheme_Black);
    }
    // ========================================================================================
    setContentView(layoutResId());
    // Direct volume changes to the alarm stream
    setVolumeControlStream(AudioManager.STREAM_ALARM);
    ButterKnife.bind(this);
    if (mToolbar != null) {
        setSupportActionBar(mToolbar);
        ActionBar ab = getSupportActionBar();
        if (ab != null) {
            ab.setDisplayHomeAsUpEnabled(isDisplayHomeUpEnabled());
            ab.setDisplayShowTitleEnabled(isDisplayShowTitleEnabled());
        }
    }
}
 
Example 17
Source Project: droidddle   File: MainActivity.java    License: Apache License 2.0 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}
 
Example 18
Source Project: actionbarextras   File: DropdownProxy.java    License: MIT License 4 votes vote down vote up
private void handleRemove(){
	ActionBar actionBar = ((AppCompatActivity)getActivity()).getSupportActionBar();
	actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
}
 
Example 19
private void showGlobalContextActionBar() {
    ActionBar actionBar = getActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    //actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setTitle(R.string.app_name);
}
 
Example 20
Source Project: jus   File: MainActivity.java    License: Apache License 2.0 4 votes vote down vote up
public void restoreActionBar() {
    ActionBar actionBar = getSupportActionBar();
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
    actionBar.setDisplayShowTitleEnabled(true);
    actionBar.setTitle(mTitle);
}