protected override void OnElementChanged(VisualElementChangedEventArgs e) { base.OnElementChanged(e); global::Android.Widget.ScrollView droidScrollView = (global::Android.Widget.ScrollView) this; droidScrollView.ScrollBarStyle = ScrollbarStyles.OutsideInset; droidScrollView.VerticalScrollbarPosition = ScrollbarPosition.Left; }
private bool CanScrollUp(global::Android.Views.View view) { if (!RefreshView.IsPullToRefreshEnabled) { return(true); } else { ViewGroup viewGroup = view as ViewGroup; if (viewGroup == null) { return(base.CanChildScrollUp()); } int sdk = (int)global::Android.OS.Build.VERSION.SdkInt; if (sdk >= 16) { // //is a scroll container such as listview, scroll view, gridview // if (viewGroup.IsScrollContainer) { return(base.CanChildScrollUp()); } } // //if you have something custom and you can't scroll up you might need to enable this //for instance on a custom recycler view where the code above isn't working! // for (int i = 0; i < viewGroup.ChildCount; i++) { var child = viewGroup.GetChildAt(i); if (child is global::Android.Widget.AbsListView) { global::Android.Widget.AbsListView list = child as global::Android.Widget.AbsListView; if (list != null) { if (list.FirstVisiblePosition == 0) { global::Android.Views.View subChild = list.GetChildAt(0); return(subChild != null && subChild.Top != 0); } // //if children are in list and we are scrolled a bit... sure you can scroll up // return(true); } } else if (child is global::Android.Widget.ScrollView) { global::Android.Widget.ScrollView scrollview = child as global::Android.Widget.ScrollView; return(scrollview.ScrollY <= 0.0); } else if (child is global::Android.Webkit.WebView) { global::Android.Webkit.WebView webView = child as global::Android.Webkit.WebView; return(webView.ScrollY > 0.0); } else if (child is global::Android.Support.V4.Widget.SwipeRefreshLayout) { return(CanScrollUp(child as ViewGroup)); } // //else if something else like a recycler view? // } return(false); } }