大佬教程收集整理的这篇文章主要介绍了android – RecyclerView LinearLayout管理器总是在横向模式下返回-1 – findLastCompletelyVisibleItemPosition(),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我如何设置布局的代码片段:@H_674_3@ @H_58_4@mRecyclerView.setHasFixedSize(true); linearlayoutmanager mLayoutManager = new linearlayoutmanager(getContext()); mRecyclerView.setLayoutManager(mLayoutManager);
布局XML:@H_674_3@
<android.support.v4.widget.SwiperefreshLayout xmlns:android="http://scheR_951_11845@as.android.com/apk/res/android" android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.RecyclerView android:id="@+id/message_list" android:layout_width="match_parent" android:layout_height="match_parent" android:BACkground="@android:color/white" android:paddingBottom="@dimen/footer_progress_bar" android:paddingTop="16dp" android:scrollbars="vertical" /> <ProgressBar android:id="@+id/progress_bar" android:layout_width="50dp" android:layout_height="50dp" android:layout_gravity="center" android:visibility="gone" /> <ProgressBar android:id="@+id/footer_progress_bar" android:layout_width="@dimen/footer_progress_bar" android:layout_height="@dimen/footer_progress_bar" android:layout_gravity="center|bottom" android:visibility="gone" /> </FrameLayout> </android.support.v4.widget.SwiperefreshLayout>
在纵向模式下,此工作正常,并始终返回正确的位置.@H_674_3@
但是在横向模式下,返回的位置始终为-1.@H_674_3@
我的问题是:@H_674_3@
有谁知道为什么会这样?@H_674_3@
我怎样才能覆盖它以返回正确的位置?@H_674_3@
如上所述,仔细检查您在RecyclerView中是否有100%可见位置.在开发者中显示边距如果你确认至少有一个完全可见的位置,那么还会发生一些更神秘的事情.@H_674_3@
以上是大佬教程为你收集整理的android – RecyclerView LinearLayout管理器总是在横向模式下返回-1 – findLastCompletelyVisibleItemPosition()全部内容,希望文章能够帮你解决android – RecyclerView LinearLayout管理器总是在横向模式下返回-1 – findLastCompletelyVisibleItemPosition()所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。