Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
RecyclerView android studio的渲染问题_Android_Xml_Android Layout_Rendering - Fatal编程技术网

RecyclerView android studio的渲染问题

RecyclerView android studio的渲染问题,android,xml,android-layout,rendering,Android,Xml,Android Layout,Rendering,我对android studio中的recyclerview有意见。当我将它添加到我的约束布局时,它会显示Android…RecyclerView,我无法向它添加任何内容。这是和。我已经搜索了整个stackoverflow,但什么也找不到。请帮忙。这是我的活动\u主xml: 转到文件>设置>构建、执行、部署>渐变,然后取消选中脱机工作 同步和构建 如果问题仍然存在,请尝试更改渲染引擎的API版本并选择应用程序的其他主题。见下图 什么意思你不能添加任何内容?您没有将内容放入recyclerview

我对android studio中的recyclerview有意见。当我将它添加到我的约束布局时,它会显示Android…RecyclerView,我无法向它添加任何内容。这是和。我已经搜索了整个stackoverflow,但什么也找不到。请帮忙。这是我的活动\u主xml:


转到文件>设置>构建、执行、部署>渐变,然后取消选中脱机工作

同步和构建

如果问题仍然存在,请尝试更改渲染引擎的API版本并选择应用程序的其他主题。见下图


什么意思你不能添加任何内容?您没有将内容放入recyclerview,而是为其设置了一个适配器。为什么我在工具栏中没有主题?单击布局xml文件的第一个,然后转到拖放的“设计”选项卡,您应该会看到这一点。如果仍然不起作用,请尝试将android.support.v7.widget.recyclerview更改为android.support.v4.widget.recyclerview,然后同步和构建。非常感谢,但我想知道为什么我在活动xml中没有很多类型的按钮,而在内容xml中有它们?而且即使我将其拖到内部,它也不会像蓝图中的纯文本一样显示组件。尝试不同的API。例17、19、23。也可以尝试其他主题,如Holo.Light。还可以尝试检查manifest.xml和gradle.script。
<?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"
    android:background="#505050"
    android:visibility="visible"
    tools:context=".MainActivity">

<EditText
    android:id="@+id/messageInput"
    android:layout_width="350dp"
    android:layout_height="54dp"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginStart="8dp"
    android:ems="10"
    android:hint="Type a message..."
    android:inputType="textPersonName"
    android:padding="5dp"
    android:singleLine="false"
    android:textColor="@android:color/white"
    android:visibility="visible"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />

<Button
    android:id="@+id/sendButton"
    android:layout_width="64dp"
    android:layout_height="wrap_content"
    android:layout_marginBottom="16dp"
    android:text="Send"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="@+id/messageInput" />

<android.support.v7.widget.RecyclerView
    android:id="@+id/messageView"
    android:layout_width="350dp"
    android:layout_height="487dp"
    android:layout_marginBottom="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:background="#56565"
    app:layout_constraintBottom_toTopOf="@+id/messageInput"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>