当前位置: 首页 > 知识库问答 >
问题:

我从recylerview获取错误,因为我试图从sqlite获取数据并设置到recylerview

百里海超
2023-03-14
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">


    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyler_data"
        android:visibility="gone"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

    </android.support.v7.widget.RecyclerView>

</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_baby_diapers"
    android:layout_width="match_parent"
    android:background="@color/colorNavIcon"
    android:layout_height="match_parent"
    tools:context="enkay.ntucsingapoor.Activity.BabyDiapers">


    <TextView
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:text="Search Bar"
        android:textSize="34dp"
        android:textStyle="bold"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="53dp"
        android:layout_marginTop="48dp"
        android:orientation="horizontal"
        >


        <Button
            android:layout_width="99dp"
            android:layout_marginLeft="279dp"
            android:layout_height="wrap_content"
            android:text="GO"
            android:background="@color/Yellow"
            />
    </LinearLayout>


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="111dp">

   <android.support.v7.widget.RecyclerView
       android:id="@+id/List_items"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       >

   </android.support.v7.widget.RecyclerView>

    </LinearLayout>


</RelativeLayout>

共有1个答案

范翰池
2023-03-14

解决方案:

在setContentView中,

将r.layout.activity_baby diapers更改为r.layout.baby_diapers。并将您的两个xml,如item xml和mainactivity xml粘贴到问题中

 类似资料:
  • //回收器和视图 //调用提取数据方法extractData(); //提取数据

  • 问题内容: 有人知道如何从任务中获取数据吗? 问题答案: 您不能直接从异步任务返回数据。 Swift 2的解决方案是使完成处理程序如下所示: 这样,仅当异步任务完成时才调用完成。这是一种无需实际使用即可“返回”数据的方法。 Swift 3版本

  • 失败:生成失败,出现异常。 > 执行时发生故障com.android.build.gradle.internal.tasks.工人$ActionFacade Android资源链接失败 /Users/macos/Documents/SubmissionExpert1/app/src/main/res/layout/data.xml:12: AAPT:错误:资源字符串/name_heroes(又名c

  • 我有一个angular应用程序,它有一个带有客舱的页面,当你点击一个客舱时,它应该会带你到客舱详细信息页面。当我用json-server数据库进行测试时,这工作得很好,但是当我创建并将其连接到我的express服务器时,当我试图导航到我的cabindetail页面时,出现了一个错误。 我是新的角度和节点,所以我有点迷失了。 这就是错误。 错误 错误:未捕获(在promise中):错误:无法匹配任何

  • 我有一个API,它返回的数据类型为_HttpClientResponse,因为我使用的是httpClient,我使用下面的 当我打印结果i/flatter(23708):字符串i/flatter(23708):{“结果”:[{“IPAddress”:“192.1.1.1”,“说明”:“Windows 2016 Server”},{“IPAddress”:“192.1.1.1”,“说明”:“Wind