How to switch from the default ConstraintLayout to RelativeLayout in Android Studio

前端 未结 16 1093
遥遥无期
遥遥无期 2020-12-02 07:49

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

16条回答
  •  抹茶落季
    2020-12-02 08:21

    I am answering this for android studio 2.3.1. One of the easiest ways to set RelativeLayout as default layout is going to text mode and editing the XML file as follows:

    Change this line:

    To

    And do check your ending tag changes to this:

    Also (optionally) go ahead and delete this line if it's being shown in grey:

    xmlns:app="http://schemas.android.com/apk/res-auto"

    Edit:

    This is an optional change to make in project, I came across this tip while going through Udacity's Android Developer Course

    If the constraint layout is not needed in the project remove the following dependency from build.gradle by deleting this line and then doing gradle sync:

        compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
    

提交回复
热议问题