gcssloop / pager-layoutmanager Goto Github PK
View Code? Open in Web Editor NEW[暂停维护]Android 网格分页布局。
Home Page: http://www.gcssloop.com/
License: Apache License 2.0
[暂停维护]Android 网格分页布局。
Home Page: http://www.gcssloop.com/
License: Apache License 2.0
Error:(276, 24) Failed to resolve: com.gcssloop.recyclerview:pagerlayoutmanager:2.3.7,高概率出现
我想实现类似iOS桌面拖拽图标,拖到页面边缘自动跳转到下个页面的效果,请问该从哪一步下手?
I don't know the language in which readme is written. Please someone suitable write English Readme.MD
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
以上报错内容
慢速滑动的时候,高概率会惯性的继续滑动一点,然后再复位。(用的demo测试的)
使用官方的立马显示。。神奇的bug
左右滑动的时候recyclerview执行时间长
您好 我之前用的这个库,现在build一直下载不下来 谢谢
第一张效果图的圆点指示器是项目自带的吗?还是自己实现的?
举个例子,当单击item要改变显示的文字时,此时调用了onLayoutChildren,会导致item显示错乱。
希望分页布局能提供翻页动画效果,以及自定义动画效果设置。
@OverRide
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
// 如果是 preLayout 则不重新布局
if (state.isPreLayout() || !state.didStructureChange()) {
return;
}
if (getItemCount() == 0) {
removeAndRecycleAllViews(recycler);
// 页面变化回调
setPageCount(0);
setPageIndex(0, false);
return;
} else {
setPageCount(getTotalPageCount());
setPageIndex(getPageIndexByOffset(), false);
}
// 计算页面数量
int mPageCount = getItemCount() / mOnePageSize;
if (getItemCount() % mOnePageSize != 0) {
mPageCount++;
}
// 计算可以滚动的最大数值,并对滚动距离进行修正
if (canScrollHorizontally()) {
mMaxScrollX = (mPageCount - 1) * getUsableWidth();
mMaxScrollY = 0;
if (mOffsetX > mMaxScrollX) {
mOffsetX = mMaxScrollX;
}
} else {
mMaxScrollX = 0;
mMaxScrollY = (mPageCount - 1) * getUsableHeight();
if (mOffsetY > mMaxScrollY) {
mOffsetY = mMaxScrollY;
}
}
// 接口回调
// setPageCount(mPageCount);
// setPageIndex(mCurrentPageIndex, false);
if (mItemWidth <= 0) {
mItemWidth = getUsableWidth() / mColumns;
}
if (mItemHeight <= 0) {
mItemHeight = getUsableHeight() / mRows;
}
mWidthUsed = getUsableWidth() - mItemWidth;
mHeightUsed = getUsableHeight() - mItemHeight;
// 预存储两页的View显示区域
for (int i = 0; i < mOnePageSize * 2; i++) {
getItemFrameByPosition(i);
}
if (mOffsetX == 0 && mOffsetY == 0) {
// 预存储View
for (int i = 0; i < mOnePageSize; i++) {
if (i >= getItemCount()) break; // 防止数据过少时导致数组越界异常
View view = recycler.getViewForPosition(i);
RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) view.getLayoutParams();
lp.width = ScreenUtils.getScreenWidth() / mColumns - (lp.leftMargin + lp.rightMargin) / 2;
addView(view);
measureChildWithMargins(view, mWidthUsed, mHeightUsed);
}
}
// 回收和填充布局
recycleAndFillItems(recycler, state, true);
}
@OverRide
public void onMeasure(RecyclerView.Recycler recycler, RecyclerView.State state, int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(recycler, state, widthMeasureSpec, heightMeasureSpec);
int widthsize = View.MeasureSpec.getSize(widthMeasureSpec); //取出宽度的确切数值
int widthmode = View.MeasureSpec.getMode(widthMeasureSpec); //取出宽度的测量模式
// 将 wrap_content 转换为 match_parent
if (widthmode != EXACTLY && widthsize > 0) {
widthmode = EXACTLY;
}
final int heightMode = View.MeasureSpec.getMode(heightMeasureSpec);
final int heightSize = View.MeasureSpec.getSize(heightMeasureSpec);
int height = 0;
//自适应高度
for (int i = 0; i < getItemCount(); i++) {
try {
measureScrapChild(recycler, i,
widthMeasureSpec,
View.MeasureSpec.makeMeasureSpec(i, View.MeasureSpec.UNSPECIFIED),
mMeasuredDimension);
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
if (i == 0) {
height = mMeasuredDimension[1];
}
}
switch (heightMode) {
case EXACTLY:
height = heightSize;
case View.MeasureSpec.AT_MOST:
case View.MeasureSpec.UNSPECIFIED:
}
setMeasuredDimension(View.MeasureSpec.makeMeasureSpec(widthsize, widthmode), height - 200);
}
private int[] mMeasuredDimension = new int[2];
private void measureScrapChild(RecyclerView.Recycler recycler, int position, int widthSpec, int heightSpec, int[] measuredDimension) {
View view = recycler.getViewForPosition(position);
if (view != null) {
RecyclerView.LayoutParams p = (RecyclerView.LayoutParams) view.getLayoutParams();
int childHeightSpec = ViewGroup.getChildMeasureSpec(heightSpec,
getPaddingTop() + getPaddingBottom(), p.height);
view.measure(widthSpec, childHeightSpec);
measuredDimension[0] = view.getMeasuredWidth() + p.leftMargin + p.rightMargin;
measuredDimension[1] = view.getMeasuredHeight() + p.bottomMargin + p.topMargin;
recycler.recycleView(view);
}
}
在初始化加载的时候,比如我设置5分,15个item,第一次加第一页时,还没滑动onBindViewHolder方法就加载被调用12次,从postion = 0 到 11,也就是最后一页没有调用
PagerGridLayoutManager库地址
对比该库新增:
无该库中调用notifyItemChanged()等方法失效问题。
如题,感觉是滑动判断有问题。
我做删除时, notifyItemRemoved(position);会有闪烁,是什么原因呢,谢谢
没有适配ViewPager,在ViewPager中快速滚动可能没法触发RecyclerView滚动
当notifyItemRemoved(position)时,第一页的几个itemView会当作一个itemView执行动画,这样看几起来是一闪的,
您好,每滑动一页,public void onPageSelect(int pageIndex)会多次回调,现在想每滑动一页,只回调一次,如何处理,谢谢
layoutManager.setPageListener(this); // 设置页面变化监听器
当以上这句代码被注释后,从左到右往回快速滑动,翻页无法触发
我以为,这句代码只是纯粹做页面变化监听,当我不想监听页面变化时,不设置也没问题
但事实上不设置监听器,layoutManager里面的部分逻辑也被跳过了,导致往回快速滑动失效
如题,拖拽item 到下一页时,如果后面有多页,会无法实现定位到下一页,会快速跳到最后一页,无法拖动到中间页
设置 竖向时
下滑是ok
但是上滑 第5个, 滑动就出现问题了
就是List集合
notifyDataSetChanged是有效的,也就是做不到刷新单个item。
如果只是刷新数据,可以使用LiveData实现。但是,如果TextView的宽度是wrapcontent,字符长度变化的时候由于控件没刷新,所以就会出现字符被切掉的问题。
rt
你好,我有一个顶部TabLayout,下面添加了一个ViewPager,在ViewPager里加载多个Fragment,然后每个Fragment中用recyclerview中添加完这个控件后,然后在滚动每个Fragment里面的recyclerView的时候 ,会触发外层viewpager的滚动事件,导致ViewPager的Fragment的切换,而不是每个Fragment里面recyclerView的一页页切换,我要实现的效果是滑动的时候先每个Fragment里面recyclerView里面一页页切换,切换到recyclerView最后一页的时候,引起viewPager的Fragment切换。怎么实现这个效果呢?
能不能设置fling的时候,类似viewpager只滚动一页
横向滚动如果页数过多(70多页每页一个),smoothScrollToPage 滑动到指定页面,刚刚开始跳转到指定页面时候没有问题,跳转几次之后 同前面页面直接跳转到末尾几个页面时候就出现错乱情况,经常跳转到最后一页。
我发现翻页的时候每次都会调用onBindViewHolder() 方法,导致加载图片混乱,怎么能让已经显示的页面,在翻页的时候不调用onBindViewHolder方法
能解决下嵌套在ViewPager中的滑动冲突问题吗,分页划不动,只会被外层ViewPager滑动
notifyItemChanged(int position, @nullable Object payload)失效
无法刷新单个条目
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.