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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM