Issue
When I create a new project in Android studio, and choose a blank activity, there is a default Constraint Layout attached.
I'm trying to follow some online tutorials with a Grid layout, but it's not working as expected because of the constraint layout.
The tutorial is a couple years old so I'm guessing the constraint layout was part of an update.
Is it possible to get rid of this constraint layout?
Below is the default XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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="com.user1.gridlayoutApp.MainActivity"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">
</android.support.constraint.ConstraintLayout>
Solution
you can just remove ConstraintLayout tags and add LinearLayout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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"
android:orientation="vertical">
</LinearLayout>
Answered By - SiniĊĦa