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


Java Toolbar.setLogo方法代码示例

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


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

示例1: onCreate

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

  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);

  // App Logo
  toolbar.setLogo(R.drawable.ic_launcher);
  // Title
  toolbar.setTitle("My Title");
  // Sub Title
  toolbar.setSubtitle("Sub title");

  setSupportActionBar(toolbar);

  // Navigation Icon 要設定在 setSupoortActionBar 才有作用
  // 否則會出現 back bottom
  toolbar.setNavigationIcon(R.drawable.ab_android);
  // Menu item click 的監聽事件一樣要設定在 setSupportActionBar 才有作用
  toolbar.setOnMenuItemClickListener(onMenuItemClick);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:MainActivity.java

示例2: setToolBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void setToolBar(Toolbar toolbar, CharSequence title, boolean backIcon, CharSequence
        subTitle, @DrawableRes int logo) {
    if (logo !=0){
        toolbar.setLogo(logo);
    }
    if (!TextUtils.isEmpty(subTitle)){
        toolbar.setSubtitle(subTitle);
    }
    if (!TextUtils.isEmpty(title)){
        toolbar.setTitle(title);
    }

    setSupportActionBar(toolbar);
    if (backIcon) {
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
}
 
开发者ID:didikee,项目名称:cnBetaGeek,代码行数:19,代码来源:BaseCnBetaActivity.java

示例3: 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

示例4: onCreate

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

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_review);
    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_review));
    setSupportActionBar(toolbar);

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

    setFromCharacterButton();
    setFromTranscriptionButton();
    setFromSCharacterButton();
    setFromSTranscriptionButton();

}
 
开发者ID:jleon95,项目名称:LearnHangul,代码行数:23,代码来源:ReviewActivity.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: onCreate

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@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());
}
 
开发者ID:BracketCove,项目名称:RecyclerViewTutorial2017,代码行数:20,代码来源:ListActivity.java

示例7: setToolBar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setToolBar(int toolBarId, ToolBarOptions options) {
    toolbar = (Toolbar) findViewById(toolBarId);
    if (options.titleId != 0) {
        toolbar.setTitle(options.titleId);
    }
    if (!TextUtils.isEmpty(options.titleString)) {
        toolbar.setTitle(options.titleString);
    }
    if (options.logoId != 0) {
        toolbar.setLogo(options.logoId);
    }
    setSupportActionBar(toolbar);

    if (options.isNeedNavigate) {
        toolbar.setNavigationIcon(options.navigateId);
        toolbar.setContentInsetStartWithNavigation(0);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onNavigateUpClicked();
            }
        });
    }
}
 
开发者ID:newDeepLearing,项目名称:decoy,代码行数:25,代码来源:UI.java

示例8: setContentView

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void setContentView(int layoutResID) {
  setTitle(R.string.D_R_Radio); // til blinde, for at undgå at "DR Radio" bliver udtalt som "Doktor Radio"
  super.setContentView(layoutResID);
  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  if (toolbar != null) {
    toolbar.setLogo(R.drawable.appikon);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    ab.setDisplayShowTitleEnabled(false);
    ab.setDisplayHomeAsUpEnabled(true);
    ab.setHomeButtonEnabled(true);

    //actionBar.setTitle(""); // tom - vi bruger logo
    progressBar = (ProgressBar) findViewById(R.id.progressBar);
  }
}
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:18,代码来源:Basisaktivitet.java

示例9: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.tool_bar);
    toolbar.setTitle("POWheel");
    toolbar.setLogo(R.mipmap.ic_launcher);
    setSupportActionBar(toolbar);


}
 
开发者ID:ponewheel,项目名称:android-ponewheel,代码行数:9,代码来源:RideDetailActivity.java

示例10: setupToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupToolbar() {
    Toolbar toolbar = findViewById(R.id.tool_bar);
    toolbar.setTitle("Logged Rides");
    toolbar.setLogo(R.mipmap.ic_launcher);

    setSupportActionBar(toolbar);

}
 
开发者ID:ponewheel,项目名称:android-ponewheel,代码行数:9,代码来源:RidesListActivity.java

示例11: onCreate

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

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_from_syllable_character_quiz);
    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.toolbar_title_from_syllable_character));
    setSupportActionBar(toolbar);

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

    // Fill the pool of transcriptions to choose from as possible answers to a question.
    for(Character c: syllables)

        transcriptions.add(c.getTranscription());

    answerButtons.add((Button) findViewById(R.id.quiz3_first_option));
    answerButtons.add((Button) findViewById(R.id.quiz3_second_option));
    answerButtons.add((Button) findViewById(R.id.quiz3_third_option));
    answerButtons.add((Button) findViewById(R.id.quiz3_fourth_option));
    answerButtons.add((Button) findViewById(R.id.quiz3_fifth_option));
    answerButtons.add((Button) findViewById(R.id.quiz3_sixth_option));

    for(Button b: answerButtons)

        setAnswerButton(b);

    setNextQuestion();

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

示例12: onCreate

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

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_from_syllable_transcription_quiz);
    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.toolbar_title_from_syllable_transcription));
    setSupportActionBar(toolbar);

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

    // Fill the pool of characters to choose from as possible answers to a question.
    for(Character c: syllables)

        characters.add(c.getCharacter());

    answerButtons.add((Button) findViewById(R.id.quiz4_first_option));
    answerButtons.add((Button) findViewById(R.id.quiz4_second_option));
    answerButtons.add((Button) findViewById(R.id.quiz4_third_option));
    answerButtons.add((Button) findViewById(R.id.quiz4_fourth_option));
    answerButtons.add((Button) findViewById(R.id.quiz4_fifth_option));
    answerButtons.add((Button) findViewById(R.id.quiz4_sixth_option));

    for(Button b: answerButtons)

        setAnswerButton(b);

    setNextQuestion();

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

示例13: setUpToolbar

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**************init method***********************/
@Override
protected void setUpToolbar(Toolbar toolbar) {
    super.setUpToolbar(toolbar);
    toolbar.setLogo(R.mipmap.logo);
    getSupportActionBar().setDisplayHomeAsUpEnabled(false);
    getSupportActionBar().setTitle("");
}
 
开发者ID:newbiechen1024,项目名称:NovelReader,代码行数:9,代码来源:MainActivity.java

示例14: initMenu

import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
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);
    setSupportActionBar(toolbar);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    // 双击 666
    final GestureDetector detector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() {
        @Override
        public boolean onDoubleTap(MotionEvent e) {
            quickToTop();   // 快速返回头部
            return super.onDoubleTap(e);
        }
    });

    toolbar.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            detector.onTouchEvent(event);
            return false;
        }
    });

    toolbar.setOnClickListener(this);

    holder.setOnClickListener(this, R.id.fab);

    loadMenuData();
}
 
开发者ID:GcsSloop,项目名称:diycode,代码行数:37,代码来源:MainActivity.java

示例15: onCreate

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

        toolbar.setLogo(R.drawable.ic_notify);
        toolbar.setTitle("PdfView");
//        toolbar.setTitleTextColor(Color.RED);
        setSupportActionBar(toolbar);

        imgPdf=(ImageView)findViewById(R.id.image_pdf);
        mAttacher = new PhotoViewAttacher(imgPdf);

        txtTitle=(TextView) findViewById(R.id.toolbar_title);
        txtTitle.setGravity(Gravity.START);
//        txtTitle.setBackgroundColor(Color.RED);
        edtPage=(EditText) findViewById(R.id.toolbar_page);
        edtPage.setGravity(Gravity.END|Gravity.CENTER);
//        edtPage.setBackgroundColor(Color.YELLOW);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

        Intent intent = getIntent();
        if (intent != null) {
            log.d("oncreate "+intent.toString());
            String action = intent.getAction();
            if (intent.ACTION_VIEW.equals(action)) {
                uri = intent.getData();
                log.d("ACTION_VIEW uri "+ uri.toString());
                openRenderer( );
                if(mPdfRenderer!=null)
                    showPage(index);
            }
        }
    }
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:44,代码来源:PdfActivity.java


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