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


Java Toolbar.setBackgroundResource方法代码示例

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


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

示例1: onCreate

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

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(true);

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    restTest = (RestTest) getIntent().getSerializableExtra("restTest");
    response = (RemoteResponse) getIntent().getSerializableExtra("response");


    mViewPager = (AdvancedViewPager) findViewById(R.id.container);
    mViewPager.setEnable(false);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);

    int code = response.getStatusCode();
    if (code >= 200 && code <= 299) {
        toolbar.setBackgroundResource(R.color.get);
        tabLayout.setBackgroundResource(R.color.get);
    } else {
        toolbar.setBackgroundResource(R.color.error);
        tabLayout.setBackgroundResource(R.color.error);
    }
    if (-1 == response.getStatusCode()) {
        ab.setTitle(response.getResponseMessage());
    } else {
        ab.setTitle(response.getStatusCode() + " " + response.getResponseMessage());
    }

}
 
开发者ID:Sayi,项目名称:RestClient,代码行数:38,代码来源:ResponseActivity.java

示例2: setTitle

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

示例3: initView

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override protected void initView(View parent) {
  requestBaseInit(getPageTitle());
  mRecyclerView = (RecyclerView) parent.findViewById(R.id.recyclerView);
  Toolbar toolbar = getToolBar();
  toolbar.inflateMenu(R.menu.main);
  toolbar.setBackgroundResource(R.color.main_color_normal);
  toolbar.setOnMenuItemClickListener(this);
  mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  mRecyclerView.setHasFixedSize(true);

  setupAdapter();
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:13,代码来源:RecyclerViewSnapUI.java

示例4: requestBaseInit

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void requestBaseInit(String title) {
  TranslucentStatusCompat.requestTranslucentStatus(getActivity());
  getToolBarShadow().setVisibility(View.GONE);
  Toolbar toolBar = getToolBar();
  getStatusBar().setBackgroundResource(R.color.main_color_normal);
  toolBar.setBackgroundResource(R.color.main_color_normal);
  TextView tvTitle = UIUtil.setCenterTitle(toolBar, title);
  CommonUtils.updateTitleText(tvTitle);
  toolBar.setNavigationIcon(R.drawable.ic_back);
  toolBar.setNavigationOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
      getActivity().onBackPressed();
    }
  });
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:16,代码来源:AppBaseFragment.java

示例5: requestBaseInitNoBack

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void requestBaseInitNoBack(String title) {
  TranslucentStatusCompat.requestTranslucentStatus(getActivity());
  getToolBarShadow().setVisibility(View.GONE);
  Toolbar toolBar = getToolBar();
  getStatusBar().setBackgroundResource(R.color.main_color_normal);
  toolBar.setBackgroundResource(R.color.main_color_normal);
  TextView tvTitle = UIUtil.setCenterTitle(toolBar, title);
  CommonUtils.updateTitleText(tvTitle);
}
 
开发者ID:liuguoquan727,项目名称:android-study,代码行数:10,代码来源:AppBaseFragment.java


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