public StickyHeaderScrollView(Context context, View header, int minHeightHeader, HeaderAnimator headerAnimator, ScrollView scrollView) : base(context, header, scrollView, minHeightHeader, headerAnimator) { // scroll events scrollView.ViewTreeObserver.AddOnGlobalLayoutSingleFire(() => headerAnimator.OnScroll(-scrollView.ScrollY)); scrollView.ViewTreeObserver.ScrollChanged += (sender, e) => headerAnimator.OnScroll(-scrollView.ScrollY); }
public StickyHeaderListView(Context context, View header, int minHeightHeader, HeaderAnimator headerAnimator, ListView listView) : base(context, header, listView, minHeightHeader, headerAnimator) { // fake header var lp = new AbsListView.LayoutParams(ViewGroup.LayoutParams.MatchParent, heightHeader); fakeHeader = new Space(context) { LayoutParameters = lp }; this.listView.AddHeaderView(fakeHeader); // scroll events this.listView.Scroll += (sender, e) => { var scrolledY = -CalculateScrollYList(); headerAnimator.OnScroll(scrolledY); }; }