1. Use an overlay on the activity layout to display the action bar, the first time the error message appears.
The error message is as follows: Java.lang.RuntimeException:Ubable to start Activity componentinfo (* * *. mainactivity): Android.util.AndroidRuntimeException:requestFeature () must be called before adding Content.
The following code is the code for the OnCreate method of Mainactivity,
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Here the code is used to set the fragment
GetWindow (). Requestfeature (Window.feature_action_bar_overlay);
Setcontentview (R.layout.activity_main);
}
Causes and solutions:
The overlapping properties of the action Bar must be set before the activity is added. It is necessary to put the code with the Green View Code before the yellow background code, the more correct way, the green background of the code placed in this line of code (super.oncreate (savedinstancestate);).
Problems with the Android learning process