Content xml is not getting created for Basic activity

1.2k Views Asked by At

While creating any activity(other than empty) in android studio it is creating only activity xml, using Android Studio 3.1.4, Kindly help.

enter image description here

3

There are 3 best solutions below

0
sasikumar On

Empty activity default contains only a single layout file

Read this Activity template

This template creates an empty activity and a single layout file with sample text content. It allows you to start from scratch when building your app module or activity.

But you can create the content layout separately then include into the main activity.

1
keser On

According to the documentation of Android Studio, activity_main.xml will affect how global UI of Activity is designed and works. But content_main.xml will affect the contents in the activity_main.xml.

Since a Basic Activity,Empty Activity doesn't have much content, thus the content_main.xml is not created for those. If you create a Navigation Drawer Activity, Studio will create both app_bar_main.xml , content_main.xml and activity_main.xml

0
navylover On

As my understanding, the activity_main xml file created by wizard is the content xml file when create Basic Activity. Then you could modify the activity_main xml to fulfil your requirment.