Android 布局编辑器:如何添加简单视图?

Android Layout Editor: How do I add a simple view?

布局编辑器的调色板似乎没有我可以拖入的空白视图(除非我的眼睛疯了)。

有没有办法将 Android 布局编辑器中的调色板中的空白视图拖到我正在制作的视图上(无需输入原始 XML)?

这是我在 "Common" 部分看到的内容:

这是我在搜索 "view" 时看到的内容:

我是不是漏掉了什么?

我在 "Containers" 部分下看到了一个“<视图>”,但这只会弹出一个弹出窗口,其中包含调色板中已有的相同内容。

我是 Android 开发人员的新手,我来自 iOS,在那里我可以直接将 UIView 拖到故事板上。这种行为在 Android 中的等价物是什么?

我可以通过某种方式将自己的自定义内容添加到布局编辑器调色板吗?

在原始 XML 中键入 <View ... /> 是实现此目的的唯一方法吗?

您可以使用 android:alpha="0.5" 设置 50% 的不透明度。

要使用简单的视图,例如作为叠加层,您可以在XML.

中使用下面的代码
<View
        android:id="@+id/overlayOrSomethingElse"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="top"
        android:alpha="0.5"
        android:background="@android:color/black" />

调色板上有一个View,你可以这样做。

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

    <View
        android:id="@+id/view"
        android:layout_width="wrap_content"
        android:layout_height="243dp"
        android:background="#0000ff"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="349dp" />

    <View
        android:id="@+id/view3"
        android:layout_width="wrap_content"
        android:layout_height="4dp"
        android:background="#ffffff"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="469dp" />

</android.support.constraint.ConstraintLayout>

我的眼睛疯了

按"Widgets"(红圈)

拖入"View"(绿色圆圈)

谁能解释为什么它在 "Widgets" 之下?