Search code examples
androidandroid-coordinatorlayout

CoordinatorLayout is not visible in Design view


Say I have a fragment:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    >

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay"
        >

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            />

    </android.support.design.widget.AppBarLayout>

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal"
        android:paddingLeft="@dimen/registration_activity_horizontal_margin"
        android:paddingRight="@dimen/registration_activity_horizontal_margin"
        android:paddingTop="@dimen/registration_activity_vertical_margin"
        >
        ...
    </android.support.constraint.ConstraintLayout>
</android.support.design.widget.CoordinatorLayout>

In Design view I get this picture.

enter image description here

How to show a right layout?


Solution

  • change gradle setting as follow->

    compileSdkVersion 28
    
    targetSdkVersion 28
    

    change dependencies as follow->

    implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    
    implementation 'com.android.support:support-v4:28.0.0-alpha1'
    
    implementation 'com.android.support:design:28.0.0-alpha1'
    
    implementation 'com.android.support:recyclerview-v7:28.0.0-alpha1'