Scrollview scrollbar not visible

I have scrollView with stack inside. Scroll works, but scrollBar not visible. I've tried to write custom renders but it didn't help. Please help.

            var contentAndWebViewLayout = new StackLayout() { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand};
            contentAndWebViewLayout.Children.Add(contentLayout);
            contentAndWebViewLayout.Children.Add(webView);

            ScrollView scrollView = new ScrollView()
            {
                Content = contentAndWebViewLayout,
                IsEnabled = true,
                IsVerticalScrollbarEnabled = true,
                IsClippedToBounds = true,
                VerticalScrollBarVisibility = ScrollBarVisibility.Always,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };

            var converter = new HtmlLabelConverter();

            var layout = new RelativeLayout()
            {
                BackgroundColor = Color.White,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            layout.Children.Add(scrollView,
            xConstraint: Constraint.Constant(0),
                    yConstraint: Constraint.Constant(0),
                    widthConstraint: Constraint.RelativeToParent((parent) => { return parent.Width; }),
                    heightConstraint: Constraint.RelativeToParent((parent) => { return parent.Height; }));

            this.Content = layout;

Best Answer

  • ColeXColeX Xamurai
    edited September 23 Accepted Answer

    @FeduniakV said:

    @ColeX said:
    In iOS custom renderer(ScrollViewRenderer) use the following code , but the built-in scroll indictor will only be shown on screen while the user is actually scrolling.

    scrollView.ShowsHorizontalScrollIndicator = true;
    scrollView.ShowsVerticalScrollIndicator = true;
    scrollView.IndicatorStyle = UIScrollViewIndicatorStyle.Black;
    scrollView.ScrollIndicatorInsets = new UIEdgeInsets(0, 30, 0, 30);
    

    Refer https://stackoverflow.com/a/38835939/8187800

    It's good, but I need on Android. I Trie to build CutomRender, set
    this.VerticalScrollBarEnabled = true;
    this.ScrollbarFadingEnabled = false;
    but it didn't visible

    I tried to downgrade Xamarin.Forms version to 3.4, problem solved !

    The issue is related with the package Xamarin.Forms updating , i will report it on github .

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    In iOS custom renderer(ScrollViewRenderer) use the following code , but the built-in scroll indictor will only be shown on screen while the user is actually scrolling.

    scrollView.ShowsHorizontalScrollIndicator = true;
    scrollView.ShowsVerticalScrollIndicator = true;
    scrollView.IndicatorStyle = UIScrollViewIndicatorStyle.Black;
    scrollView.ScrollIndicatorInsets = new UIEdgeInsets(0, 30, 0, 30);
    

    Refer https://stackoverflow.com/a/38835939/8187800

  • FeduniakVFeduniakV Member ✭✭

    @ColeX said:
    In iOS custom renderer(ScrollViewRenderer) use the following code , but the built-in scroll indictor will only be shown on screen while the user is actually scrolling.

    scrollView.ShowsHorizontalScrollIndicator = true;
    scrollView.ShowsVerticalScrollIndicator = true;
    scrollView.IndicatorStyle = UIScrollViewIndicatorStyle.Black;
    scrollView.ScrollIndicatorInsets = new UIEdgeInsets(0, 30, 0, 30);
    

    Refer https://stackoverflow.com/a/38835939/8187800

    It's good, but I need on Android. I Trie to build CutomRender, set
    this.VerticalScrollBarEnabled = true;
    this.ScrollbarFadingEnabled = false;
    but it didn't visible

  • ColeXColeX Member, Xamarin Team Xamurai
  • FeduniakVFeduniakV Member ✭✭
    edited September 23

    My code example https://github.com/FeduniakVitalii/ScrollView nothing helps, scrollBar doaesn't visible((

  • ColeXColeX Member, Xamarin Team Xamurai
    edited September 23 Accepted Answer

    @FeduniakV said:

    @ColeX said:
    In iOS custom renderer(ScrollViewRenderer) use the following code , but the built-in scroll indictor will only be shown on screen while the user is actually scrolling.

    scrollView.ShowsHorizontalScrollIndicator = true;
    scrollView.ShowsVerticalScrollIndicator = true;
    scrollView.IndicatorStyle = UIScrollViewIndicatorStyle.Black;
    scrollView.ScrollIndicatorInsets = new UIEdgeInsets(0, 30, 0, 30);
    

    Refer https://stackoverflow.com/a/38835939/8187800

    It's good, but I need on Android. I Trie to build CutomRender, set
    this.VerticalScrollBarEnabled = true;
    this.ScrollbarFadingEnabled = false;
    but it didn't visible

    I tried to downgrade Xamarin.Forms version to 3.4, problem solved !

    The issue is related with the package Xamarin.Forms updating , i will report it on github .

  • FeduniakVFeduniakV Member ✭✭

    @ColeX said:

    @FeduniakV said:

    @ColeX said:
    In iOS custom renderer(ScrollViewRenderer) use the following code , but the built-in scroll indictor will only be shown on screen while the user is actually scrolling.

    scrollView.ShowsHorizontalScrollIndicator = true;
    scrollView.ShowsVerticalScrollIndicator = true;
    scrollView.IndicatorStyle = UIScrollViewIndicatorStyle.Black;
    scrollView.ScrollIndicatorInsets = new UIEdgeInsets(0, 30, 0, 30);
    

    Refer https://stackoverflow.com/a/38835939/8187800

    It's good, but I need on Android. I Trie to build CutomRender, set
    this.VerticalScrollBarEnabled = true;
    this.ScrollbarFadingEnabled = false;
    but it didn't visible

    I tried to downgrade Xamarin.Forms version to 3.4, problem solved !

    The issue is related with the package Xamarin.Forms updating , i will report it on github .

    Thank you!!! =)

  • ColeXColeX Member, Xamarin Team Xamurai
Sign In or Register to comment.