修改AS新建布局文件

现在AndroidStudio默认新建的Activity的布局是android.support.constraint.ConstraintLayout,尽管是推荐的,而且说是拖拽性很强,但我还是习惯xml里面直接编写!所以我每次新建后都会把布局改为LinearLayout,能不能让其可以每次新建都使用LinearLayout呢,当让可以,直接修改As安装目录的默认xml生成文件就可以了!

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

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        />

</android.support.constraint.ConstraintLayout>

改为LinearLayout就可以了

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

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        />

</LinearLayout> 

就是修改AS的安装地址对应的目录下的simple.xml.ftl,我的是 E:\android-studio\plugins\android\lib\templates\activities\common\root\res\layout

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容