简体   繁体   中英

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.

在此处输入图片说明

How to show a right layout?

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM