Processing records for Activity_main.xml and fragment_main.xml files in the layout folder

Source: Internet
Author: User

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

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.