将Android Studio默认布局ConstraintLayout切换成LinearLayout

时间:2023-03-09 09:56:58
将Android Studio默认布局ConstraintLayout切换成LinearLayout
将Android Studio默认布局ConstraintLayout切换成LinearLayout
大部分人初次使用google android 扁平化布局ConstraintLayout都感到不太熟悉,而Android Studio的默认布局就是ConstraintLayout,所以想将其默认布局改为LinearLayout

找到安装AS路径:

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"
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!"
/> </LinearLayout>

重开AS即可