RecyclerView方法onCreateViewHolder()和onBindViewHolder()没有调用
来源:互联网 发布:仿淘宝省市地区级联 编辑:程序博客网 时间:2024/06/07 09:58
原因:至今小编都未知,初步分析为
android.support.constraint.ConstraintLayout有bug
打印log getItemCount() > 0
RecyclerViewAdapter 构造方法执行了
RecyclerView 基本的都设置了,还是不行。
最后只能修改布局文件,去掉布局文件中的外层包裹
<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"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:orientation="vertical"> <android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:src="@drawable/to_top22" /> </LinearLayout> </android.support.constraint.ConstraintLayout>
数据不显示时的布局文件
<?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"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <include layout="@layout/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:clickable="true" android:orientation="vertical"> <android.support.v4.widget.SwipeRefreshLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.v4.widget.SwipeRefreshLayout> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|bottom" android:orientation="vertical"> <android.support.design.widget.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="@dimen/fab_margin" android:src="@drawable/to_top22" /> </LinearLayout> </android.support.constraint.ConstraintLayout>
阅读全文
0 0
- RecyclerView方法onCreateViewHolder()和onBindViewHolder()没有调用
- RecyclerView没有调用onCreateViewHolder()和onBindViewHolder()的可能原因
- RecyclerView不调用onCreateViewHolder和onBindViewHolder的解决方法
- RecycleView设置点击的两种方式:adapter中的onBindViewHolder(VH,int)方法中进行;实现RecyclerView的addonItemTouchListerner()
- Recyclerview调用notifyDataSetChanged()方法无效原因
- Android中RecyclerView调用notifyDataSetChanged方法无效
- iOS dealloc方法没有调用
- ondraw方法没有被调用
- Android Studio 里面类和方法实际被调用了,但是AS显示没有被调用
- 判断方法有没有实现和判断能不能调用某个方法
- iOS 定位没有弹出请求提示框和调用代理方法
- finalize方法为何没有被调用??
- SPField的GetValidatedString方法没有被调用
- SPField的GetValidatedString方法没有被调用
- listview绑定数据没有调用getview方法
- Fragment中的onActivityResult方法没有被调用
- RecyclerView添加addHeader和addFooter方法
- RecyclerView添加Header和Footer的方法
- PAT a1091题解
- PAT a1092题解
- p5.js入门教程(3) 平滑过渡(Easing)
- 关于freertos的heap1
- Java基础 按数值传递
- RecyclerView方法onCreateViewHolder()和onBindViewHolder()没有调用
- 失去的时候才发现其珍贵,人没有目标是最可怕的
- Mac下安装和使用brew
- win10系统修改hosts文件无法保存
- linux学习之旅(七)&& 进程间通信之信号
- BZOJ 4552 [Tjoi2016&Heoi2016]排序
- JavaScript正则表达式
- 深度学习、自然语言处理和表征方法
- wampserver 0xc0000142