将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即可

相关文章:

  • 2022-01-02
  • 2021-06-09
  • 2022-02-09
  • 2021-05-04
  • 2021-11-24
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-29
  • 2021-12-03
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案