why is there content_main.xml and activity_main.xml by default instead of just activity_main.xml?

后端 未结 5 1993
不思量自难忘°
不思量自难忘° 2021-01-14 00:52

I have just begun learning Android App development. I have Android Studio 1.4. In my layout folder I have two XML files (content_main.xml and activity_mai

5条回答
  •  耶瑟儿~
    2021-01-14 01:15

    As I know, there must be include statement in your activity_main.xml file as follows :

     
    

    that means it is calling the content_main.xml which has actual elements to be hold.

    There will be no problem if you cut and paste all the content of content_main.xml file and paste it in activity_main.xml file in place of include statement(tag). You can delete your content_main.xml after doing as above.

    In your activity setContentView() statement should be look like as below :

    setContentView(R.layout.activity_main);
    

提交回复
热议问题