【问题标题】:Android studio layout editor doesn't renderAndroid Studio 布局编辑器不呈现
【发布时间】:2020-08-15 20:01:17
【问题描述】:

我一直在 Android Studio 中做一个小项目,但遇到了一个问题。在我的布局中,我一直在使用 fabs 和约束布局,但是当我尝试打开编辑器时,我看到黑屏,应用程序仍然运行良好。我收到的信息是: 渲染时引发异常:对象不是声明类的实例

这是布局的 XML:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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">


    <TextView

        android:id="@+id/Settings_text_view_ip_adress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="80dp"
        android:layout_marginEnd="8dp"
        android:text="IP adress"
        app:layout_constraintEnd_toStartOf="@+id/Settings_edit_text_ip_adress"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />

    <EditText
        android:id="@+id/Settings_edit_text_ip_adress"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="36dp"
        android:ems="10"
        android:hint="IP"
        android:inputType="number"
        android:digits="0123456789."
        app:layout_constraintBottom_toBottomOf="@+id/Settings_text_view_ip_adress"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@+id/Settings_text_view_ip_adress" />


    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/floatingActionButton10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:clickable="true"
        android:onClick="save_and_return_to_prev_activity"
        app:backgroundTint="#4CAF50"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:srcCompat="@drawable/settings_pic"
        />
</androidx.constraintlayout.widget.ConstraintLayout>

【问题讨论】:

  • 附上你所拥有的图片
  • 重启AS。
  • 没用,我试过重置缓存也没有用
  • 你的 AS 更新了吗?
  • 不是。我马上更新。

标签: android-studio android-constraintlayout floating-action-button android-layout-editor


【解决方案1】:

将您的 Android Studio 更新到最新版本

【讨论】:

    猜你喜欢
    • 2013-05-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-23
    • 1970-01-01
    • 1970-01-01
    • 2021-08-01
    • 2021-10-26
    相关资源
    最近更新 更多