当前位置: 首页>>代码示例>>Java>>正文


Java Toolbar.setBackgroundColor方法代码示例

本文整理汇总了Java中android.support.v7.widget.Toolbar.setBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.setBackgroundColor方法的具体用法?Java Toolbar.setBackgroundColor怎么用?Java Toolbar.setBackgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.widget.Toolbar的用法示例。


在下文中一共展示了Toolbar.setBackgroundColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onThemeApplied

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onThemeApplied(Theme theme) {
    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(toolbarColor);
    toolbar.setTitleTextColor(textColorPrimary);

    if (theme.darkStatusBarIcons() &&
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int statusBarColor = getStatusBarColor();
        getWindow().setStatusBarColor(statusBarColor);
    }
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:17,代码来源:SettingsActivity.java

示例2: onCreate

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	if(Utils.hasKitKat() && !Utils.hasLollipop()){
		setTheme(R.style.Theme_Document_Translucent);
	}
	setContentView(R.layout.activity_about);

	Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
	mToolbar.setTitleTextAppearance(this, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
	if(Utils.hasKitKat() && !Utils.hasLollipop()) {
		//((LinearLayout.LayoutParams) mToolbar.getLayoutParams()).setMargins(0, getStatusBarHeight(this), 0, 0);
		mToolbar.setPadding(0, getStatusBarHeight(this), 0, 0);
	}
	int color = SettingsActivity.getPrimaryColor();
	mToolbar.setBackgroundColor(color);
	setSupportActionBar(mToolbar);
	getSupportActionBar().setDisplayHomeAsUpEnabled(true);
	getSupportActionBar().setTitle(null);
	setUpDefaultStatusBar();

	initControls();
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:24,代码来源:AboutActivity.java

示例3: setupViews

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupViews() {
    setTitle(AppConstants.APP_TITLE);
    setContentView(R.layout.activity_main);
    listview = (ListView) findViewById(R.id.listview);
    listview.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            nextSelection = tokenlist.get(i);
            startSupportActionMode(MainActivity.this);
            return true;
        }
    });
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setBackgroundColor(getResources().getColor(PIBLUE));
    if (getSupportActionBar() != null) {
        getSupportActionBar().setLogo(R.mipmap.ic_launcher);
        getSupportActionBar().setDisplayUseLogoEnabled(true);
    }
}
 
开发者ID:privacyidea,项目名称:privacyidea-authenticator,代码行数:21,代码来源:MainActivity.java

示例4: onCreate

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState){

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about_hangul);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(ContextCompat.getColor(getApplicationContext(),R.color.blue));
    toolbar.setLogo(R.mipmap.ic_launcher);
    toolbar.setTitleMarginStart(90);
    toolbar.setTitle(getString(R.string.toolbat_title_about_hangul));
    setSupportActionBar(toolbar);

    TextView textAboutHangul = (TextView) findViewById(R.id.text_about_hangul);
    textAboutHangul.setMovementMethod(new ScrollingMovementMethod());

}
 
开发者ID:jleon95,项目名称:LearnHangul,代码行数:17,代码来源:AboutHangulActivity.java

示例5: onCreate

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState){

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_study);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(ContextCompat.getColor(getApplicationContext(),R.color.red));
    toolbar.setLogo(R.mipmap.ic_launcher);
    toolbar.setTitleMarginStart(90);
    toolbar.setTitle(getString(R.string.toolbar_title_study));
    setSupportActionBar(toolbar);

    vowels = (ArrayList<Character>) getIntent().getExtras().get("com.learnhangul.learnhangul.vowels");
    consonants = (ArrayList<Character>) getIntent().getExtras().get("com.learnhangul.learnhangul.consonants");

    setVowelsButton();
    setConsonantsButton();
    setAboutHangulButton();

}
 
开发者ID:jleon95,项目名称:LearnHangul,代码行数:21,代码来源:StudyActivity.java

示例6: onThemeApplied

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onThemeApplied(Theme theme) {
    Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(toolbarColor);
    toolbar.setTitleTextColor(textColorPrimary);

    if (theme.darkStatusBarIcons() &&
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int statusBarColor = getStatusBarColor();
        getWindow().setStatusBarColor(statusBarColor);
    }

}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:18,代码来源:ExcludePathsActivity.java

示例7: onThemeApplied

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onThemeApplied(Theme theme) {
    if (pick_photos) {
        return;
    }

    final Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(toolbarColor);
    toolbar.setTitleTextColor(textColorPrimary);

    if (theme.darkStatusBarIcons()) {
        Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
    } else {
        Util.setLightStatusBarIcons(findViewById(R.id.root_view));
    }

    if (theme.statusBarOverlay()) {
        addStatusBarOverlay(toolbar);
    }
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:21,代码来源:MainActivity.java

示例8: setInitialConfiguration

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setInitialConfiguration() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });
    toolbar.setBackgroundColor(AppPreferences.get(this).getPrimaryColor());

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle(R.string.storage);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    getWindow().setStatusBarColor(OtherUtils.dark(AppPreferences.get(this).getPrimaryColor(), 0.8));
    getWindow().setNavigationBarColor(AppPreferences.get(this).getPrimaryColor());
}
 
开发者ID:dkanada,项目名称:OpenAPK,代码行数:19,代码来源:StorageActivity.java

示例9: setInitialConfiguration

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setInitialConfiguration() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });
    toolbar.setBackgroundColor(AppPreferences.get(context).getPrimaryColor());

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setTitle("");

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    getWindow().setStatusBarColor(OtherUtils.dark(AppPreferences.get(context).getPrimaryColor(), 0.8));
    getWindow().setNavigationBarColor(AppPreferences.get(context).getPrimaryColor());
}
 
开发者ID:dkanada,项目名称:OpenAPK,代码行数:19,代码来源:AppActivity.java

示例10: onThemeApplied

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onThemeApplied(Theme theme) {
    if (pick_photos) {
        return;
    }

    final Toolbar toolbar = findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(toolbarColor);
    toolbar.setTitleTextColor(textColorPrimary);

    FloatingActionButton fab = findViewById(R.id.fab);
    fab.setBackgroundTintList(ColorStateList.valueOf(accentColor));

    if (theme.darkStatusBarIcons()) {
        Util.setDarkStatusBarIcons(findViewById(R.id.root_view));
    } else {
        Util.setLightStatusBarIcons(findViewById(R.id.root_view));
    }

    if (theme.statusBarOverlay()) {
        addStatusBarOverlay(toolbar);
    }
}
 
开发者ID:kollerlukas,项目名称:Camera-Roll-Android-App,代码行数:24,代码来源:AlbumActivity.java

示例11: setupAppBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupAppBar() {
    setStatusBarColor(this.mStatusBarColor);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(this.mToolbarColor);
    toolbar.setTitleTextColor(this.mToolbarTextColor);
    TextView toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
    toolbarTitle.setTextColor(this.mToolbarTextColor);
    toolbarTitle.setText(this.mToolbarTitle);
    Drawable stateButtonDrawable = ContextCompat.getDrawable(this, R.drawable.ucrop_ic_cross)
            .mutate();
    stateButtonDrawable.setColorFilter(this.mToolbarTextColor, Mode.SRC_ATOP);
    toolbar.setNavigationIcon(stateButtonDrawable);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:UCropActivity.java

示例12: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setupToolbar(int toolbarId, String title, @ColorRes int titleColor, @ColorRes int colorBg, @DrawableRes int burger){
    toolbar = (Toolbar) findViewById(toolbarId);
    toolbar.setBackgroundColor(getResources().getColor(colorBg));
    setSupportActionBar(toolbar);
    TextView pageTitle = (TextView) toolbar.findViewById(R.id.tv_title);
    pageTitle.setText(title);
    pageTitle.setTextColor(getResources().getColor(titleColor));
    getSupportActionBar().setTitle("");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeAsUpIndicator(burger);
}
 
开发者ID:ahmadnurhidayat,项目名称:Cook-It-Android-XML-Template,代码行数:12,代码来源:BaseActivity.java

示例13: setInitialConfiguration

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setInitialConfiguration() {
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setBackgroundColor(appPreferences.getPrimaryColor());

    setSupportActionBar(toolbar);
    getSupportActionBar().setTitle(R.string.app_name);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    getWindow().setStatusBarColor(OtherUtils.dark(appPreferences.getPrimaryColor(), 0.8));
    getWindow().setNavigationBarColor(appPreferences.getPrimaryColor());
}
 
开发者ID:dkanada,项目名称:OpenAPK,代码行数:12,代码来源:MainActivity.java

示例14: setupSubredditAppBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
 * Sets up the activity's support toolbar and colorizes the status bar. Applies color theming
 * based on the theme for the subreddit specified.
 *
 * @param toolbar        The toolbar's id
 * @param title          String to be set as the toolbar title
 * @param enableUpButton Whether or not the toolbar should have up navigation
 * @param subreddit      The subreddit to base the theme on
 */
protected void setupSubredditAppBar(@IdRes int toolbar, String title, boolean enableUpButton,
                                    String subreddit) {
    mToolbar = (Toolbar) findViewById(toolbar);
    mToolbar.setBackgroundColor(Palette.getColor(subreddit));
    setSupportActionBar(mToolbar);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(enableUpButton);
        getSupportActionBar().setTitle(title);
    }

    themeSystemBars(subreddit);
    setRecentBar(title, Palette.getSubredditStatusBarColor(subreddit));
}
 
开发者ID:ccrama,项目名称:Slide-RSS,代码行数:24,代码来源:BaseActivity.java

示例15: onCreate

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main2);
  StatusBarCompat.compat(this, 0x20000000);

  toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setBackgroundColor(0x0f00ff);
  setSupportActionBar(toolbar);

  drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
  ActionBarDrawerToggle toggle =
      new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open,
          R.string.navigation_drawer_close) {
        @Override public void onDrawerOpened(View drawerView) {
          super.onDrawerOpened(drawerView);
          System.out.println("drawer open");
          showFragment = false;
          getUserEvent();
        }
      };
  drawer.setDrawerListener(toggle);
  toggle.syncState();

  navigationView = (NavigationView) findViewById(R.id.nav_view);
  menu = navigationView.getMenu();
  //menu.findItem(R.id.nav_release).setVisible(false);
  menu.findItem(R.id.nav_change).setVisible(false);
  navigationView.setNavigationItemSelectedListener(this);

  headerView = navigationView.getHeaderView(0);
  if (headerView != null) {
    headerView.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        if (ApiHelper.getInstance().loginStatus()) {
          Bundle bundle = new Bundle();
          bundle.putString(UserInfoFragment.User_Name,
              ApiHelper.getInstance().getEmail() + "@" + getString(R.string.title_email_suffix));
          bundle.putString("title", getString(R.string.toolbar_user_info));
          ActivityUtils.startFragment(HomeActivity.this, LConsts.FragmentType.UserInfo, bundle);
        }
      }
    });
    tvCompany = (TextView) headerView.findViewById(R.id.tvCompany);
    tvEmail = (TextView) headerView.findViewById(R.id.tvEmail);
    ivHeader = (ImageView) headerView.findViewById(R.id.imageView);
    tvEmail.setText(ApiHelper.getInstance().getEmail());
  }

  //navigationView.setLis

  supportFragmentManager = getSupportFragmentManager();
  showFragment = true;
  getUserEvent();

  initRxBus();
}
 
开发者ID:Lingzh0ng,项目名称:ITSM,代码行数:57,代码来源:HomeActivity.java


注:本文中的android.support.v7.widget.Toolbar.setBackgroundColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。