我可以在Android Studio中更改默认布局吗? [英] Can I change the default layout in Android Studio?
问题描述
当我在Android Studio中使用空白活动创建新项目时,默认情况下它使用RelativeLayout.我想将空白活动"的默认值更改为LinearLayout,而不是编辑每个活动-可以吗?
When I create a new project with a Blank Activity in Android Studio, it uses a RelativeLayout by default. I'd like to change that Blank Activity default to LinearLayout, rather than editing each activity - is that possible?
推荐答案
我已经在这里回答了这个问题:如何更改默认值Android Studio中的模板文件.
I have already answered this question here: How to change a default template files in Android Studio.
基本上,您需要查看recipe_fragment.xml.ftl
文件,因此,您知道哪些文件用于模板.
Basically you need to look at the recipe_fragment.xml.ftl
file, so you, know which files are used for the template.
默认模板文件位于:
...\Android\Android Studio\plugins\android\lib\templates\activities
因此,根据BlankActivity模板的配方,它表示根据该配方使用../common/recipe_simple.xml.ftl
(如果您不想使用片段布局),则表示使用此文件来构建BlankActivity :
So according to the recipe for the BlankActivity template, it says that it uses ../common/recipe_simple.xml.ftl
(if you dont't want to use a fragment layout) according to that recipe, it says that is uses this file to build the BlankActivity:
...\Android\Android Studio\plugins\android\lib\templates\activities\common\root\res\layout\simple.xml.ftl
只需在您喜欢的文本编辑器中将RelativeLayout替换为LinearLayout(将文件移动到桌面并在其中进行编辑),就可以得到想要的东西,但我建议您制作自己的模板,而不是可以定义任何内容.
by simply replacing RelativeLayout with LinearLayout in your favourite text editor (move the file to the Desktop and edit it over there), you get what you want, but instead of that, I recommend you to make your own template, where you can define literally anything.
这篇关于我可以在Android Studio中更改默认布局吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!