Open laminsk opened 9 years ago
Implement ObservableScrollViewCallbacks on your MainActivity
In your fragment which includes an ObservableScrollView, implement the following flows:
mCallback = (ObservableScrollViewCallbacks) activity;
mScrollView.setScrollViewCallbacks(mCallback);
Please tell me if it helps.
Thanks for the reply. Unfortunately, I still can't get it to work yet.
Currently, onScrollChanged implementation is in fragment but since I remove "ObservableScrollViewCallbacks" from fragment and put that in activity, it no longer works.
Since I implemented ObservableScrollViewCallbacks in Activity, how the activity would interact with components from Fragment, for instance:
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
int baseColor = getResources().getColor(R.color.primary);
float alpha = Math.min(1, (float) scrollY / mParallaxImageHeight);
mToolbarView.setBackgroundColor(ScrollUtils.getColorWithAlpha(alpha, baseColor));
ViewHelper.setTranslationY(mImageView, scrollY / 2);
// please note that mImageView in fragment, not in activity
}
Thanks again for helping me out. Leo
Thank you so much again for your help. There's one tiny issue with top Actionbar, it's still visible when you click on sliding up panel. When sliding up, the actionbar should be hidden behind the panel.
What I'm trying to achieve is just like "Google Play" Music app, when you click on a particular album in Google play music app, it will show the album artwork with transparent action bar initially. However, when scrolling up, actionbar with be visible again along with slide in animation, it will then slide out when scrolling down.
Many thanks once again for your kind help.
@laminsk Since I put that toolbar to the last inside MainActivity's FrameLayout xml so It will be the view on top therefore It's always shown up. You can just put it before your SlidingUpLayoutPanel inside that xml file to achieve what you want.
@eneim Thank you once again and much appreciated for your help.
@laminsk you are welcome. Please checkout this, I fix it for your requirement.
Change MainActivity layout to overlay SlidingPanel over Toolbar
@eneim That's exactly how I wanted it. You are a star!
@laminsk you are welcome. Is this issue Ok to close? ^^
Yes, please go ahead. Its all sorted :)
On Thu, Jul 16, 2015 at 3:30 AM, Nam Nguyen Hoai notifications@github.com wrote:
@laminsk https://github.com/laminsk you are welcome. Is this issue Ok to close? ^^
— Reply to this email directly or view it on GitHub https://github.com/ksoichiro/Android-ObservableScrollView/issues/168#issuecomment-121805695 .
Hi there
Thanks for the wonderful library :) I'm trying to use this for my project and currently experiencing a problem which I hope you could be able to help me out please.
I have main activity which I use to load all other fragments. The main activity is using this library https://github.com/umano/AndroidSlidingUpPanel. Both android.support.v7.widget.Toolbar and container body (which I uses to load child fragments) is in MainActivity layout.
I'm trying to use this example ParallaxToolbarScrollViewActivity and trying to achieve the same result using fragment. I would be most grateful if you could provide a pointer or any suggestion would be greatly appreciated.
Leo