设置Android Studio工程布局文件的默认布局

每次创建新的工程后,布局文件的的布局总是ConstraintLayout,如何更改?

进入Android Studio安装目录,用文本编辑器打开文件plugins\android\lib\templates\activities\common\root\res\layout\simple.xml.ftl

将文件内容修改为

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="Hello World" />
</LinearLayout>

保存更改,以后创建的新工程里的默认布局就是LinearLayout

猜你喜欢

转载自www.cnblogs.com/buyishi/p/9188763.html