Recently in a project, the use of third-party open source projects, mainly to achieve android5.0 after the launch of the Materialdesign style, but the code has been written, found that a run on the flash, so start debugging, found that the problem appears in
1 Toolbar Toolbar = (Toolbar) Findviewbyid (R.id.toolbar); 2 Setsupportactionbar (toolbar);
Obviously it should be in the second line error, and then according to the log on Logcat:
false in your theme to use a Toolbar instead.
< Span class= "PLN" >< Span class= "PLN" >< Span class= "KWD" >< Span class= "KWD" >
So it should be in conflict with the Actionbar in the activity, and finally try to know it many times, is to list file, set the activity's style
(as long as the activity that is useful to this line of code needs to define a style under the Activity node), you can set
as follows
1 <ActivityAndroid:name=". Mainactivity "2 Android:label= "Test"3 Android:theme= "@style/materialdrawertheme.light.darktoolbar">4 <Intent-filter>5 <ActionAndroid:name= "Android.intent.action.MAIN"/>6 7 <categoryAndroid:name= "Android.intent.category.LAUNCHER"/>8 </Intent-filter>9 </Activity>
This refers to the third line, so that it does not cause the program to crash.
BOB
2016-09-06
Setsupportactionbar (Toolbar) causes program crashes to flash back