Search code examples
androidandroid-relativelayout

How to Change 'Constraint Layout View' to 'Relative Layout View'


Iam trying to change from Constraint Layout view to Relative Layout View in android stdio.

I have tried changing and edit the Template files from @ROOTTAG TO Relative layout but nothing seems to be changed

<android.support.constraint.RelativeLayout 
xmlns:androclass="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

</RelativeLayout> 

Solution

  • <?xml version="1.0" encoding="utf-8"?>    
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androclass="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >
    
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world" />
    
    </RelativeLayout>