【发布时间】:2018-07-20 19:49:54
【问题描述】:
假设我有一个片段:
<?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>
在设计视图中,我得到了这张照片。
如何显示正确的布局?
【问题讨论】:
-
您是否尝试过 Sync Project with gradle files 、Clean Project 或 Rebuild???
-
@code4rox,是的,再次制作,没有任何改变。但是在设备中它是正确的。
-
试试这个 File->Invalidate Caches/Restarts
-
您是否为布局预览选择了正确的主题?
-
@code4rox,谢谢,但它没有改变。库版本中存在问题。
标签: android android-coordinatorlayout