首页 > 解决方案 > 我在 android studio 中创建 android 项目时没有自动创建布局资源目录

问题描述

起初,当我在 android studio 中创建我的 android 项目时,android studio 会自动创建一个布局资源目录,其中包含 activity_main.xml 文件以及 java 目录中的 main.kt 文件。但是在创建了一些项目后,android studio 无法自动为我提供带有 activity_main.xml 和 main.kt 文件的布局目录。我是 android studio 环境的初学者,这就是为什么我更喜欢它带有布局资源文件夹和 activity_main 文件夹的原因,因为当我搞砸了配置时我自己创建它们并且无法在我的android手机上午餐应用程序。我想知道是否有办法扭转这个问题,或者我应该总是自己创建我的布局资源目录,如果是这样,我想演示一下如何创建我的 main_activity。xml,这样我就不会弄乱配置。任何帮助将不胜感激,并在此先感谢。

标签: android-studiokotlin

解决方案


It seems you are looking to create from a template (create activity along with the layout and added the activity in the manifest as well). Please read the docs in here: https://developer.android.com/studio/projects/templates


推荐阅读