I have the latest android Studio (2.3 beta 3) and it seems ConstraintLayout is the default when creating a project. How can I make Android Studio use the RelativeLayout as t
The easiest method is to go to your .xml file in text mode, and replace the top line:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
And then proceed to replace it with:
<android.widget.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
If you then go back into design mode, you can see that you now have a relative layout. This also automatically changes the end tag, so no issues there.
I think u want to change the default settings of android studio. Whenever a layout or Activity in created u want to create "RelativeLayout" by default. In that case, flow the step below
you are done
Android studio 3.0
step0:
Close android studio
step1:
Goto C:\Program Files\Android\Android Studio\plugins\android\lib\templates\activities\common\root\res\layout\
step2:
Backup simple.xml.ftl
step3:
Change simple.xml.ftl to code below and save :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${packageName}.${activityClass}">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="12dp"
android:layout_marginTop="21dp"
android:text="don't forget to click useful if this helps. this is my first post at stackoverflow!"
android:textSize="20sp"
/>
</RelativeLayout>
for android studio 3.1
If you want your default android studio change, just follow bellow steps:
first
go to C:\Program Files\Android\Android Studio\plugins\android\lib\templates\activities\common\root\res\layout
i.e. the file directory where you have installed android studio.
then
copy simple.xml from another place just for backup
after that
open simple.xml file and replace it's code as bellow
<?xml version="1.0" encoding="utf-8"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${packageName}.${activityClass}">
</RelativeLayout>
but if you just want to change this project layout, just go to activity_main.xml and then go to text and post upper code to there