android.support.v7.widget.Toolbar.setLogo()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中android.support.v7.widget.Toolbar.setLogo()方法的一些代码示例,展示了Toolbar.setLogo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.setLogo()方法的具体详情如下:
包路径:android.support.v7.widget.Toolbar
类名称:Toolbar
方法名:setLogo

Toolbar.setLogo介绍

暂无

代码示例

代码示例来源:origin: smuyyh/BookReader

@Override
public void initToolBar() {
  mCommonToolbar.setLogo(R.mipmap.logo);
  setTitle("");
}

代码示例来源:origin: omadahealth/LolliPin

private void initView() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.id_toolbar);
    setSupportActionBar(toolbar);

    toolbar.setTitle("Title");
    toolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
    toolbar.setSubtitle("SubTitle");
    toolbar.setSubtitleTextColor(getResources().getColor(android.R.color.white));
    toolbar.setLogo(R.drawable.ic_launcher);
    toolbar.setNavigationIcon(R.drawable.ic_menu_white_36dp);
  }
}

代码示例来源:origin: GcsSloop/diycode

private void initMenu(ViewHolder holder) {
  Toolbar toolbar = holder.get(R.id.toolbar);
  toolbar.setLogo(R.mipmap.logo_actionbar);
  toolbar.setTitle("");
  DrawerLayout drawer = holder.get(R.id.drawer_layout);

代码示例来源:origin: envyfan/AndroidReview

/**
   * 是否隐藏ToolBar Logo
   *
   * @param show
   */
  public void showOrHideToolBarLogo(boolean show) {
    if (show) {
//            toolbar.setLogo(R.mipmap.ic_top);
    } else {
      toolbar.setLogo(null);
    }
  }

代码示例来源:origin: xfshipan/miappstore

@Override
protected void initToolBar() {
  super.initToolBar();
  view = View.inflate(this, R.layout.activity_main, null);
  toolbar = (Toolbar) view.findViewById(R.id.toolbar);
  drawerLayout = (DrawerLayout) view.findViewById(R.id.drawer_layout);
  toolbar.setBackgroundColor(getResources().getColor(R.color.light_toolbar));
  toolbar.setTitle("应用商店");
  toolbar.setLogo(R.mipmap.logo);//设置Logo
  setSupportActionBar(toolbar);
  ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(
      this, drawerLayout, toolbar, R.string.app_name, R.string.app_name
  );
  drawerLayout.setDrawerListener(drawerToggle);
  drawerToggle.syncState();
}

代码示例来源:origin: nanchen2251/CoordinatorAppBarDemo

@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_coor_app_bar);

    mRecyclerView = (RecyclerView) findViewById(R.id.recycler);
    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    mToolBar.setLogo(getResources().getDrawable(R.mipmap.ic_launcher));
    mToolBar.setTitle("这是标题");
    mToolBar.inflateMenu(R.menu.menu);

    mStringList = new ArrayList<>();

    for (int i = 0; i < 100; i++) {
      mStringList.add("测试:"+i);
    }

    mAdapter = new CommonRecyclerAdapter<String>(this,mStringList,R.layout.layout_item) {
      @Override
      public void convert(CommonRecyclerHolder holder, String item, int position, boolean isScrolling) {
        holder.setText(R.id.item_text,mStringList.get(position));
      }
    };

    mRecyclerView.setAdapter(mAdapter);

    mRecyclerView.setLayoutManager(new LinearLayoutManager(this,LinearLayoutManager.VERTICAL,false));

  }
}

代码示例来源:origin: hiphonezhu/Android-Demos

@Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_with_collapsingtoolbar);
//        setContentView(R.layout.activity_with_collapsingtoolbar_2);
    setContentView(R.layout.activity_with_collapsingtoolbar_3);

    Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
    toolbar.setTitle("标题");
    toolbar.setLogo(getResources().getDrawable(R.mipmap.ic_launcher));
    setSupportActionBar(toolbar);

    CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout)findViewById(R.id.collapsingToolbarLayout);
//        collapsingToolbarLayout.setTitleEnabled(false);
//        collapsingToolbarLayout.setTitle("这是标题");

    TextView tv = (TextView)findViewById(R.id.tv);
    for (int i = 0; i < 50; i++) {
      tv.append((i + 1) + "\n");
    }
  }
}

代码示例来源:origin: BracketCove/RecyclerViewTutorial2017

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_list);
  recyclerView = (RecyclerView) findViewById(R.id.rec_list_activity);
  layoutInflater = getLayoutInflater();
  toolbar = (Toolbar) findViewById(R.id.tlb_list_activity);
  toolbar.setTitle(R.string.title_toolbar);
  toolbar.setLogo(R.drawable.ic_view_list_white_24dp);
  toolbar.setTitleMarginStart(72);
  FloatingActionButton fabulous = (FloatingActionButton) findViewById(R.id.fab_create_new_item);
  fabulous.setOnClickListener(this);
  controller = new Controller(this, new FakeDataSource());
}

代码示例来源:origin: XiqingLiu/GEEK

mHandler = new MyHandler(this);
mToolbar.setTitle(title);
mToolbar.setLogo(new ColorDrawable(Color.TRANSPARENT));
try {
  ImageView mLogoView = (ImageView) ReflectUtils.getField(mToolbar, mToolbar.getClass().getName(), "mLogoView");

代码示例来源:origin: XiqingLiu/GEEK

/**
 * 在有上一页的时候返回上一页
 */
@Override
public void onBackPressed() {
  if (mWebView.canGoBack()) {
    mWebView.goBack();
    mWebView.getUrl();
    mToolbar.setLogo(R.mipmap.close);
    mToolbar.setTitle("  " + mToolbar.getTitle());
    if (type == WebType.WEB_DETAIL) {
      mWebView.setVisibility(View.INVISIBLE);
    }
  } else {
    super.onBackPressed();
  }
}

代码示例来源:origin: ruuvi/com.ruuvi.station

Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setLogo(R.drawable.logo);

代码示例来源:origin: chaychan/MaterialDesignExercise

mToolbar.setLogo(R.mipmap.ic_launcher);//设置logo

代码示例来源:origin: pinguo-zhouwei/MaterialDesignSamples

toolbar.setLogo(R.mipmap.ic_launcher);

代码示例来源:origin: okleine/spitfirefox

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  viewPager = (ViewPager) findViewById(R.id.pager);
  viewPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
  viewPager.setAdapter(viewPagerAdapter);
  //Initialize the action bar
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  toolbar.setLogo(R.drawable.spitfire_logo);
  toolbar.setSubtitle(R.string.app_subtitle);
  setSupportActionBar(toolbar);
  this.clientApplication = new CoapClient();
  this.requestFragment = new RequestFragment();
  this.responseFragment = new ResponseFragment();
  this.hideKeyboard();
}

代码示例来源:origin: programmerr47/navigation-widgets

toolbar.setLogo(navigationBuilder.toolbarLogoRes);
} else {
  toolbar.setLogo(navigationBuilder.toolbarLogo);

相关文章

Toolbar类方法