Android PopupWindow 中 RecyclerView item 显示不全的解决方案

版权声明:本文为【路易斯】原创文章,转载请注明出处! https://blog.csdn.net/RichieZhu/article/details/79692648

当PopupWindow 显示空间过短时候,如 1~ 9 和 10以后的宽度是不一致的,
当前第一屏正好显示 显示 1~9 item 以内,第10行未出现在 popupwindow 第一屏 导致滚动后第二屏10 ~ 以后 也显示不全 ,但是如果第一屏能够显示10以后的 就正常的

示意图:

这里写图片描述

外面加一层 NestedScrollView

         NestedScrollView nestedScrollView = new NestedScrollView(mContext);
                nestedScrollView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT));

结果:
这里写图片描述

代码已上传至:
https://github.com/louisgeek/ClassicPopupWindow

猜你喜欢

转载自blog.csdn.net/RichieZhu/article/details/79692648