这里是将默认的ConstraintLayout 修改为了LinearLayout
模板文件保存路径为:
D:\Program Files\JetBrains\IntelliJ IDEA 2020.3.4\plugins\android\lib\templates\activities\common\root\res\layout\simple.xml.ftl
修改前:
<?xml version="1.0" encoding="utf-8"?>
<${getMaterialComponentName('android.support.constraint.ConstraintLayout', useAndroidX)}
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
<#if appBarLayoutName??>
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/${appBarLayoutName}"
</#if>
tools:context="${packageName}.${activityClass}">
<#if isNewModule!false>
<TextView
<#if includeCppSupport!false>
android:id="@+id/sample_text"
</#if>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</#if>
</${getMaterialComponentName('android.support.constraint.ConstraintLayout', useAndroidX)}>
修改后:
<?xml version="1.0" encoding="utf-8"?>
<${getMaterialComponentName('LinearLayout', useAndroidX)}
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
<#if appBarLayoutName??>
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/${appBarLayoutName}"
</#if>
tools:context="${packageName}.${activityClass}">
</${getMaterialComponentName('LinearLayout', useAndroidX)}>
省去了每次创建模块后手工修改的麻烦,当然,您想创建的时候自动生成什么东西也是可以在这里预定义的。包括其它自动生成的文件。比如styles.xml. color.xml….
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/139903.html