Android about toolbar minutes to play dead yourself?

Source: Internet
Author: User

Scenario One:
10 o ' clock this morning with the usual morning to buy a cup of porridge and then drink to work, walk for 15 minutes to the company, and then hit the fingerprint door, and then happy to write code, I wipe, good want the computer did not boot, I faint as if no glasses, found that the recent memory is not very good, is not the first two days of noon , feel the body is hollowed out, work during the day, go back in the evening to change paper I also not easy AH! Well nonsense said so much, open car walk up! Then by this toolbar play a day, cool crooked! I'm really a cook!

Toolbar (In fact, I think he is very uncomfortable)

Toolbar is a Material design-style navigation control that started in Android 5.0, and Google highly recommends using Toolbar as the navigation bar for Android clients to replace the previous Actionbar. Compared with Actionbar, Toolbar is obviously more flexible. It is not like Actionbar, it must be fixed at the top of the activity, but can be placed in the interface anywhere. In addition, in the design of Toolbar, Google also left developers a lot of customizable changes, these customizable properties are detailed in the API documentation, such as:

1, set the navigation bar icon;
2, set the app logo;
3, support to set the title and sub-headings;
4, support to add one or more custom controls or custom view;
5, support action Menu;

Here's how to kill yourself, I originally toolbar write in Baseactivity, and then wrote a method whether to display toolbar A Boolean value, one is the string two parameter code as follows

ToolBar  toolbar=initToolBar(true,"我的");toolbar.set toolbar.setNavigationIcon(R.mipmap.ic_back);//设置导航栏图标

And then I set off the title bar before Acitivity, and then my theme is Theme.notitlebarr theme.

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏  

And then finally own breakpoint with a bit did not solve, found every time is nullpointerexception, directly on the flash back, that speed too fast scare me, than we usually play heroes league should be a bit more, after all, man Zi elder brother is 5 seconds true man haha! There is no way I think of the watercress code 9.99 elder brother, tell him to look at it, OK, then he helped me to look, and then said you are not silly, I said yes how, really, I am silly I am not silly where there is today this article, the baby is silly, but the baby does not say!

Finally found himself really stupid, my baseactivity inherited is V7 package of appcompatactivity
Then it was found that the title bar removed where I was made such a mistake, clearly key in the hand I still go to find the key, really no solution!

I this article is not introduced toolbar, today CSDN is also not on, follow-up I will update this blog, I hope you understand, this time just come in, suddenly feel a kind of inexplicable feeling haha!
I'm having dinner! Bye! Happy Weekend!

Solution:

Just get rid of this code, OK.

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏  

Reference article:

Http://www.jianshu.com/p/79604c3ddcae

Android about toolbar minutes to play dead yourself?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.