【发布时间】:2018-06-17 18:35:39
【问题描述】:
编辑:我是stackoverflow的新手,所以它不会让我直接上传..请点击下面的链接 Android Studio EMPTY DESIGN
它在模拟器和我的物理设备中运行良好,但我在设计布局上看不到任何东西.. 我已经尝试了以下通过搜索谷歌获得的解决方案 更新的 SDK 更新了 Android Studio 我也尝试过构建>清理项目
文件>使缓存无效/重新启动 试图将 API 更改为旧版本,如 API 25 和 API 26 ..(当前安装的 API 28).. 仍然没有任何工作可以帮助我.. XML 代码
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"
app:srcCompat="@drawable/ball_100x100"
tools:layout_editor_absoluteX="127dp"
tools:layout_editor_absoluteY="399dp" />
</android.support.constraint.ConstraintLayout>
【问题讨论】:
-
您可以通过点击右上角的红色图标来检查错误或警告
-
@Yatin 它说渲染问题..无法实例化一个或多个类
-
@SmitShah 大多数情况下,您使用的是来自外部库的自定义视图,设计预览无法处理,但是当您运行应用程序时它会起作用
-
您可以通过更改 api 级别进行检查并进行锻炼