1.如上图,as升级到2.3之后,新建布局默认变成了约束布局
2.在as安装目录\plugins\Android\lib\templates\activities\common\root\res\layout下,找到simple.xml.ftl文件
3.用以下布局替换
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}">
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
4.重启as,大公告成!
-
顶
本文介绍如何将 Android Studio 2.3 的默认布局从约束布局改为相对布局。通过修改 simple.xml.ftl 文件,可以轻松实现这一更改。
3208

被折叠的 条评论
为什么被折叠?



