Why does this layout work in preview but not on my device?
<p>I am developing an Android application for school. The layout I worked out looks good for me on the preview of Android Studio, but as soon as I deploy it on my physical device (HTC One m8, Android 5.0.1), everything inside the cardview is messed up.</p>

<p>Layout file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout 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:orientation="vertical"
    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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="de.seschi98.trgapp.activities.ScheduleActivity"
    tools:showIn="@layout/activity_schedule"&gt;



    &lt;android.support.v7.widget.CardView
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_height="120dp"&gt;


        &lt;GridLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:columnCount="4"
            android:rowCount="1"
            android:columnOrderPreserved="false"
            android:orientation="horizontal"
            android:rowOrderPreserved="false"&gt;

            &lt;TextView
                android:id="@+id/lesson_number"
                android:text="01"
                android:textSize="22dp"
                android:layout_width="wrap_content"
                android:layout_column="0"
                android:layout_row="0"
                android:layout_rowWeight="1"
                android:gravity="center_vertical|center_horizontal"
                android:textStyle="bold"
                android:layout_columnWeight="20" /&gt;

            &lt;GridLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_column="1"
                android:layout_row="0"
                android:columnCount="2"
                android:layout_columnWeight="90"
                android:rowCount="3"
                android:layout_height="match_parent"&gt;


                &lt;TextView
                    android:gravity="center_vertical|center_horizontal"
                    android:id="@+id/lesson_name"
                    android:text="Chemistry"
                    android:textSize="22dp"
                    android:layout_height="wrap_content"
                    android:layout_column="1"
                    android:layout_row="0"
                    android:layout_rowWeight="15"
                    android:layout_gravity="center_horizontal"
                    android:paddingTop="10dp"
                    android:layout_width="match_parent" /&gt;

                &lt;TextView
                    android:gravity="bottom|center_horizontal"
                    android:id="@+id/teacher"
                    android:text="Mr Smith"
                    android:layout_height="wrap_content"
                    android:textSize="16dp"
                    android:layout_column="1"
                    android:layout_row="1"
                    android:layout_rowWeight="20"
                    android:layout_gravity="center_horizontal"
                    android:layout_width="match_parent" /&gt;


                &lt;TextView
                    android:gravity="top|center_horizontal"
                    android:id="@+id/room"
                    android:text="Room A-123"
                    android:textSize="16dp"
                    android:layout_height="wrap_content"
                    android:layout_column="1"
                    android:layout_row="2"
                    android:layout_rowWeight="20"
                    android:layout_gravity="center_horizontal"
                    android:layout_width="match_parent" /&gt;


            &lt;/GridLayout&gt;

            &lt;View android:layout_row="0"
                android:layout_column="2"
                android:layout_height="match_parent"
                android:layout_width="0dp"
                android:layout_columnWeight="15"&gt;

            &lt;/View&gt;

            &lt;View android:layout_row="0"
                android:id="@+id/badge"
                android:layout_column="3"
                android:layout_height="match_parent"
                android:layout_width="0dp"
                android:background="#c0392b"
                android:layout_columnWeight="5"&gt;

            &lt;/View&gt;


        &lt;/GridLayout&gt;

    &lt;/android.support.v7.widget.CardView&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p><a href="http://i.stack.imgur.com/488DU.png" rel="nofollow">Preview Screenshot</a></p>

<p><a href="http://i.imgur.com/xfG0GuV.png" rel="nofollow">Device Screenshot</a> (don´t matter about the action bar or other stuff, it´s only the CardView...)</p>

<p>// Update: Upgraded my Android version to 6.0.0 Marshmallow yesterday, now it is working fine. But I included the AppCompat thing... What could be the reason for it to not work on previous versions of Android?</p>