ParallaxEverywhere
ParallaxEverywhere copied to clipboard
Parallax stops when PEWImageView is set to be a group in an ExpandableListView
Hello,
I am inflating a view with a PEWImageView in it. Like this:
@Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) this.currentContext .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (groupPosition == 0){
Log.d("Inflating: ", "Show Image Parallax");
convertView = inflater.inflate(R.layout.parallax_show_image_layout,null);
parallaxImageShowView = convertView;
parallaxImageView = (PEWImageView) convertView.findViewById(R.id.show_parallax_image);
parallaxImageView.setReverseY(true);
Picasso.with(currentContext).load(showInfoBundle.getString("showImageUrl")).into(parallaxImageView);
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:pew="http://schemas.android.com/tools">
<com.fmsirvent.ParallaxEverywhere.PEWImageView
android:layout_width="match_parent"
android:layout_height="250dp"
android:scaleType="centerCrop"
android:background="@color/c_black"
pew:interpolation="accelerate"
android:id="@+id/show_parallax_image"
android:layout_alignParentStart="true" />
After the list is scrolled to the bottom or close to the bottom when you scroll back up I noticed that parallax effect stops and the image gets stuck in the position that the interpolator animation moved it after it did the parallax effect as I was scrolling down. It will not act the same way as I scroll up. It does it once and thats it. The only solution is to re-inflate the view when the list is scrolled to the bottom, but that is costly. Can you suggest a solution to this or is it something that I am doing wrong ?
Thank you.
Hey i have added PEW image view in StickyHeaderExpandable List view but i noticed that the effect doesn't work have you figured out the issue?
Nope. I just removed the lib from the project. It was a bummer. I like this lib.
Hey guys,
Override the PEWImageView like this:
`public class ParalaxImageView extends PEWImageView{
public ParalaxImageView(Context context) {
super(context);
}
public ParalaxImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ParalaxImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void setImageResource(int resId) {
super.setImageResource(resId);
invalidate();
}
@Override
public void setImageDrawable(Drawable drawable) {
super.setImageDrawable(drawable);
invalidate();
}
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
invalidate();
}
}`
And it will work fine.
I'll submit a pull request soon.