0

我在用着

Android Studio 3.1.3
Build #AI-173.4819257, built on June 4, 2018
JRE: 1.8.0_152-release-1024-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-29-generic

有依赖关系

implementation 'com.android.support:appcompat-v7:28.0.0-beta01'

这是工具栏布局:

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:elevation="4dp"
    app:popupTheme="@style/AppTheme.PopupOverlay"
    app:theme="@style/ToolBarStyle" />

问题: Android Studio 没有显示设计布局,但我在运行代码时可以看到工具栏。

4

1 回答 1

2

这是 sdk 28 中的一个错误。他们将在未来的更新中修复这个问题。可能是当它的稳定版本出来的时候。我也遇到过这个问题,我的做法是:

1)在模拟器或真机上测试。

或者

2) 在 sdk 27​​ 中编码我的项目(这样我可以看到布局),在设备上进行测试时,我将其更改为 sdk 28。

我希望这个答案对你有所帮助。

于 2018-08-02T09:46:57.317 回答