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

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

找到安装AS路径:

Android Studio\plugins\android\lib\templates\activities\common\root\res\layout 

下面的simple.xml.ftl文件用记事本打开 
上面显示为扁平化布局的默认代码,要将其修改为线性布局 


将所有代码改成:

 1 <?xml version="1.0" encoding="utf-8"?>  
 2 <LinearLayout  
 3     xmlns:android="http://schemas.android.com/apk/res/android"  
 4     xmlns:app="http://schemas.android.com/apk/res-auto"  
 5     android:layout_width="match_parent"  
 6     android:layout_height="match_parent">  
 7 
 8     <TextView  
 9         android:layout_width="wrap_content"  
10         android:layout_height="wrap_content"  
11         android:text="Hello World!"  
12     />  
13 
14 
15 </LinearLayout> 

重开AS即可

猜你喜欢

转载自www.cnblogs.com/tsingke/p/9068985.html