RecyclerView方法onCreateViewHolder()和onBindViewHolder()没有调用
2017-07-23 06:49
561 查看
原因:至今小编都未知,初步分析为
打印log getItemCount() > 0
RecyclerViewAdapter 构造方法执行了
RecyclerView 基本的都设置了,还是不行。
最后只能修改布局文件,去掉布局文件中的外层包裹
数据不显示时的布局文件
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>
相关文章推荐
- RecyclerView不调用onCreateViewHolder和onBindViewHolder的解决方法
- RecyclerView没有调用onCreateViewHolder()和onBindViewHolder()的可能原因
- RecycleView设置点击的两种方式:adapter中的onBindViewHolder(VH,int)方法中进行;实现RecyclerView的addonItemTouchListerner()
- Error:(13, 8) 错误: xxx不是抽象的, 并且未覆盖xxx中的抽象方法onBindViewHolder(BaseSimpleRecyclerAdapter.ViewHolder,int)
- Android WebView onReceivedTitle 方法不被调用的问题
- 在Viewpager的子Activity中startActivityForResult调用其他Activity时候遭遇到onActivityResult方法不响应的问题.
- Fragment中的onActivityResult方法没有被调用
- Fragment + ViewPager中Fragment的onCreateView方法没有被执行
- activity调用onCreate()方法后没有调用onStart()方法
- 差点被坑死,Fragment onAttach方法没有被调用
- 自定义view中onMeasure、onLayout、onDraw、onFinishInflate、onSizeChanged方法调用时机
- Android中的自定义Adapter(继承自BaseAdapter)——与系统Adapter的调用方法一致——含ViewHolder显示效率的优化
- Android中的自定义Adapter(继承自BaseAdapter)——与系统Adapter的调用方法一致——含ViewHolder显示效率的优化
- Android RecyclerView调用notifyDataSetChanged方法无效的解决方法
- 安卓开发没有关闭界面就调用了onActivityResult方法?onActivityResult方法Intent-data总是null
- Android中的onConfigurationChanged方法没有被调用的原因
- android service bindService onServiceConnected没有调用
- iOS开发tableview为什么没有调用heightForRowAtIndexPath方法
- 在onAnimationEnd方法中调用 viewgroup.removeview,报 nullpointerexception异常的解决方法
- Android中的自定义Adapter(继承自BaseAdapter)——与系统Adapter的调用方法一致——含ViewHolder显示效率的优化