將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"
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>