ANDROIDSDK update to 22.6 after the new project was created under the Layout folder appears under the Activity_main.xml and Fragment_ Main.xml, this is to use fragmentation in the development of a tablet, but to make the person who does not need it is not accustomed to make the following changes
(1) Replace the contents of the Activity_main.xml with the contents of Fragment_main.xml, delete the Fragment_main.xml,activity_main.xml content as follows
1 <Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"2 Xmlns:tools= "Http://schemas.android.com/tools"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 Android:paddingbottom= "@dimen/activity_vertical_margin"6 Android:paddingleft= "@dimen/activity_horizontal_margin"7 Android:paddingright= "@dimen/activity_horizontal_margin"8 Android:paddingtop= "@dimen/activity_vertical_margin"9 Tools:context= "Com.example.xsfnews.mainactivity$placeholderfragment" >Ten One <TextView A Android:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content" - Android:text= "@string/hello_world" /> the - </Relativelayout>
(2) will mainactivity inherit mainactivity extends Activity, delete the first outside of the @override function, at this time will be error re-import the package can (Ctrl+shift+o) modified file as follows
1 Packagecom.example.xsfnews;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 6 Public classMainactivityextendsActivity {7 8 @Override9 protected voidonCreate (Bundle savedinstancestate) {Ten Super. OnCreate (savedinstancestate); One Setcontentview (r.layout.activity_main); A - if(Savedinstancestate = =NULL) { - the } - } - - + -}
This can be developed in accordance with previous habits, in which the import project appears invalid project description, check that the file is placed in the default path of the Android project folder, will produce the same file what, Just change the item to a different folder
Processing records for Activity_main.xml and fragment_main.xml files in the layout folder