Java Code Examples for android.support.v7.widget.Toolbar#setLogo()
The following examples show how to use
android.support.v7.widget.Toolbar#setLogo() .
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 check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From miappstore with Apache License 2.0 | 6 votes |
@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(); }
Example 2
Source File: UiUtils.java From android-galaxyzoo with GNU General Public License v3.0 | 6 votes |
static void showToolbar(final AppCompatActivity activity) { //The layout XML should include our toolbar.xml, //which we use instead of an ActionBar, //See also our use of <item name="windowActionBar">false</item> in styles.xml. final Toolbar toolbar = (Toolbar) activity.findViewById(R.id.toolbar); if (toolbar != null) { activity.setSupportActionBar(toolbar); //Remove the title text from the app bar (toolbar/actionbar) //because we instead use an icon that shows the title. final ActionBar actionBar = activity.getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } //TODO: Why can't we specify this via android:logo in the XML: toolbar.setLogo(R.drawable.ic_toolbar_icon); } }
Example 3
Source File: RideDetailActivity.java From android-ponewheel with MIT License | 5 votes |
private void setupToolbar() { Toolbar toolbar = findViewById(R.id.tool_bar); toolbar.setTitle("POWheel"); toolbar.setLogo(R.mipmap.ic_launcher); setSupportActionBar(toolbar); }
Example 4
Source File: RidesListActivity.java From android-ponewheel with MIT License | 5 votes |
private void setupToolbar() { Toolbar toolbar = findViewById(R.id.tool_bar); toolbar.setTitle("Logged Rides"); toolbar.setLogo(R.mipmap.ic_launcher); setSupportActionBar(toolbar); }
Example 5
Source File: MainActivity.java From NovelReader with MIT License | 5 votes |
/**************init method***********************/ @Override protected void setUpToolbar(Toolbar toolbar) { super.setUpToolbar(toolbar); toolbar.setLogo(R.mipmap.logo); getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setTitle(""); }
Example 6
Source File: MainActivity.java From diycode with Apache License 2.0 | 5 votes |
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(); }
Example 7
Source File: BaseActivity.java From NightWatch with GNU General Public License v3.0 | 5 votes |
private void setupToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(getMenuName()); toolbar.setNavigationIcon(R.drawable.ic_drawer); toolbar.setLogo(R.drawable.ic_icon); setSupportActionBar(toolbar); }
Example 8
Source File: LockedCompatActivity.java From LolliPin with MIT License | 5 votes |
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); }
Example 9
Source File: BaseActivity.java From NightWatch with GNU General Public License v3.0 | 5 votes |
private void setupToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(getMenuName()); toolbar.setNavigationIcon(R.drawable.ic_drawer); toolbar.setLogo(R.drawable.ic_icon); setSupportActionBar(toolbar); }
Example 10
Source File: MainActivity.java From android-ponewheel with MIT License | 4 votes |
private void setupToolbar() { Toolbar mToolbar = findViewById(R.id.tool_bar); mToolbar.setTitle("POWheel"); mToolbar.setLogo(R.mipmap.ic_launcher); setSupportActionBar(mToolbar); }
Example 11
Source File: UIView.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
public void setToolBar(int toolbarId, int titleId, int logoId) { toolbar = (Toolbar) findViewById(toolbarId); toolbar.setTitle(titleId); toolbar.setLogo(logoId); setSupportActionBar(toolbar); }
Example 12
Source File: MainActivity.java From com.ruuvi.station with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); drawerLayout = findViewById(R.id.main_drawerLayout); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setLogo(R.drawable.logo); handler = new Handler(); prefs = new Preferences(this); myRuuviTags = RuuviTag.getAll(true); ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close ); drawerLayout.addDrawerListener(drawerToggle); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); } drawerToggle.syncState(); ListView drawerListView = findViewById(R.id.navigationDrawer_listView); drawerListView.setAdapter( new ArrayAdapter<>( this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.navigation_items) ) ); drawerListView.setOnItemClickListener(drawerItemClicked); if (prefs.isFirstStart()) { Intent intent = new Intent(this, WelcomeActivity.class); startActivityForResult(intent, FROM_WELCOME); } else { getThingsStarted(false); } }
Example 13
Source File: ToolbarActivity.java From AndroidViewDemo with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.ac_toolbar_toolbar); // 设置主标题及其颜色 toolbar.setTitle("AndroidViewDemo"); toolbar.setTitleTextColor(Color.WHITE); // 设置次标题及其颜色 toolbar.setSubtitle("AigeStudio"); toolbar.setSubtitleTextColor(Color.LTGRAY); // 设置导航按钮 toolbar.setNavigationIcon(R.drawable.menu); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(ToolbarActivity.this, "Navigation", Toast.LENGTH_SHORT).show(); } }); // 设置Logo图标 toolbar.setLogo(R.mipmap.ic_launcher); // 设置菜单及其点击监听 toolbar.inflateMenu(R.menu.ac_toolbar_menu); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { String result = ""; switch (item.getItemId()) { case R.id.ac_toolbar_copy: result = "Copy"; break; case R.id.ac_toolbar_cut: result = "Cut"; break; case R.id.ac_toolbar_del: result = "Del"; break; case R.id.ac_toolbar_edit: result = "Edit"; break; case R.id.ac_toolbar_email: result = "Email"; break; } Toast.makeText(ToolbarActivity.this, result, Toast.LENGTH_SHORT).show(); return true; } }); }
Example 14
Source File: ActivityEditor.java From Clip-Stack with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_editor); super.onCreate(savedInstanceState); Intent intent = getIntent(); oldText = intent.getStringExtra(Intent.EXTRA_TEXT); isStarred = intent.getBooleanExtra(ClipObjectActionBridge.STATUE_IS_STARRED, false); if (oldText == null || oldText.equals(getString(R.string.clip_notification_single_text))) { oldText = ""; } editText = (EditText) findViewById(R.id.edit_text); mFAB = (ImageButton) findViewById(R.id.main_fab); mToolbar = (Toolbar) findViewById(R.id.my_toolbar); editText.setText(oldText); editText.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); } } }); db = Storage.getInstance(this); // if is copied form other application. if (Intent.ACTION_SEND.equals(intent.getAction()) && "text/plain".equals(intent.getType())) { oldText = ""; } String titleText = getString(R.string.title_activity_activity_editor); if (oldText.isEmpty()) { titleText = getString(R.string.title_activity_editor); } mToolbar.setLogo(R.drawable.ic_action_edit); getSupportActionBar().setDisplayHomeAsUpEnabled(false); getSupportActionBar().setTitle(titleText); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setTaskDescription(new ActivityManager.TaskDescription( titleText + ": " + MyUtil.stringLengthCut(oldText, 4), BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_edit), getResources().getColor(R.color.primary) )); } }
Example 15
Source File: GLDemoActivity.java From java6-android-gldemos with Apache License 2.0 | 2 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_activity_layout); Resources resources = getResources(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setLogo(R.drawable.ic_launcher); toolbar.setTitle(R.string.app_title); toolbar.setContentInsetsAbsolute(0, 0); setSupportActionBar(toolbar); deviceGLVersion = AndroidGLESUtil.getGLVersion(this); adapter = new GLHeaderAdapter(this); adapter.addSectionHeaderItem(resources.getString(R.string.header_gles_3_0)); adapter.addItem(GLSLInvert.class, XeGLES3.GLES3_0, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles30demo-glslinvert"); adapter.addItem(GLSLKuwahara.class, XeGLES3.GLES3_0, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles30demo-glslkuwahara"); adapter.addItem(GLSLKuwaharaFBO.class, XeGLES3.GLES3_0, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles30demo-glslkuwaharafbo"); adapter.addSectionHeaderItem(resources.getString(R.string.header_gles_3_1)); adapter.addItem(ComputeBasicRayTrace.class, XeGLES3.GLES3_1, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles31demo-computebasicraytrace"); adapter.addItem(ComputeInvert.class, XeGLES3.GLES3_1, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles31demo-computeinvert"); adapter.addItem(ComputeInvertSampler.class, XeGLES3.GLES3_1, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles31demo-computeinvertsampler"); ListView listView = (ListView)findViewById(R.id.main_listview); listView.setAdapter(adapter); listView.setOnItemClickListener(this); listView.setOnItemLongClickListener(this); }