android - CoordinatorLayout 在设计视图中不可见
问题描述
假设我有一个片段:
<?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>
在设计视图中,我得到了这张照片。
如何显示正确的布局?
解决方案
更改gradle设置如下->
compileSdkVersion 28
targetSdkVersion 28
更改依赖项如下->
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'
推荐阅读
- python - Python 3.7.1 尝试除了在命令行中以错误顺序发生的块
- go - 如何强制客户端使用 http/2?(而不是回退到 http 1.1)
- php - 如何将数据从excel上传并保存到数据库?
- c++ - 重新排列拆分字符串的顺序并放入变量中
- android - 为什么 SVG 文件中的文本属性在资产导入时不会出现在 Android Studio 矢量资产 XML 中
- java - 向尤里卡休息服务端点发送多部分文件请求的异常
- python - 部分 tensorflow 代码不能通过 Go To Declaration 定向到
- java - 如何在保持 Java 代码机密的同时将 HTML/CSS/JS 委托给某人?
- publish - 发布 nopcommerce 3.80 新代码时出现 DLL 错误
- java - 编译和运行 JUnit 测试套件