mirror of
https://github.com/alibaba/vlayout.git
synced 2026-10-16 20:51:03 +08:00
fix item's width and height were replaced by default params.
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@
|
||||
GROUP=com.alibaba.android
|
||||
ARTIFACT=vlayout
|
||||
VERSION=1
|
||||
VERSION_NAME=1.2.38
|
||||
VERSION_NAME=1.2.39
|
||||
PACKAGING_TYPE=aar
|
||||
useNewSupportLibrary=true
|
||||
systemProp.compileSdkVersion=26
|
||||
|
||||
@@ -81,7 +81,14 @@ public abstract class RecyclablePagerAdapter<VH extends RecyclerView.ViewHolder>
|
||||
//so the attributes of layoutParam such as widthFactor and position will also be reused,
|
||||
//while these attributes should be reset to default value during reused.
|
||||
//Considering ViewPager.LayoutParams has a few inner attributes which could not be modify outside, we provide a new instance here
|
||||
container.addView(holder.itemView, new ViewPager.LayoutParams());
|
||||
|
||||
ViewPager.LayoutParams layoutParams = new ViewPager.LayoutParams();
|
||||
if (holder.itemView.getLayoutParams() != null) {
|
||||
layoutParams.width = holder.itemView.getLayoutParams().width;
|
||||
layoutParams.height = holder.itemView.getLayoutParams().height;
|
||||
}
|
||||
|
||||
container.addView(holder.itemView, layoutParams);
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user