Android Studio - 无法在没有 class 属性的情况下扩充视图标签

Android Studio -Unable to inflate view tag without class attribute

当我在我的 xml 代码中输入一个视图标签时,我得到一个渲染问题,上面写着:"Unable to inflate view tag without class attribute"。我该如何解决这个问题?

    <view
        android:layout_width="1dp"
        android:layout_height="match_parent"
        android:background="@android:color/darker_gray">
    </view>

当我删除这段代码时,它呈现得很好。

正如 Blackbelt 在评论中提到的,将 view 更新为 View

<View
    android:layout_width="1dp"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray">
</View>
<View
    android:layout_width="1dp"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray">
</View>

您必须使用 View 而不是 view