您的位置:首页 > 移动开发 > Android开发

Android Studio如何把约束布局(ConstraintLayout)改为相对布局(RelativeLayout)

2017-09-30 20:55 591 查看
前言:Android Studio升级到2.3之后新建Activity布局变成了约束(ConstraintLayout)布局,新手可能还不大会用,所以相对布局(RelativeLayout)的控件拖拽定位比较合适。

1.在Android Studio安装目录\plugins\android\lib\templates\activities\common\root\res\layout下,找到simple.xml.ftl文件,并打开

C:\Program Files\Android\Android Studio\plugins\android\lib\templates\activities\common\root\res\layout
(默认安装的同学直接复制上面地址打开就可以啦)



2.把下面代码复制替换掉原来的布局

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


3.重启Android Studio,OK!



end、、、、、、
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: