Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Android ListView seperator is always visible (even if set to none)

$
0
0

I have a ListView in Android where all cells have different Colors.

When I set the SeparatorVisibility to "None" there is still a seperator between the cells (1px), which has the color of the Background (red in the screenshot).

Is there no way on Android to remove the seperator completly?

public class App : Application
    {
        public App()
        {
            var listview = new ListView
                               {
                                   SeparatorColor = Color.Transparent,
                                   SeparatorVisibility = SeparatorVisibility.None,
                                   ItemsSource = new List<Color> { Color.Black, Color.Blue, Color.Green, Color.White },
                                   ItemTemplate = new DataTemplate(() => this.GetViewCell())
                               };

            this.MainPage = new ContentPage
                                {
                                    Content =
                                        new StackLayout
                                            {
                                                BackgroundColor = Color.Red,
                                                VerticalOptions = LayoutOptions.FillAndExpand,
                                                Children = { listview }
                                            }
                                };
        }

        private ViewCell GetViewCell()
        {
            var layout = new StackLayout();
            layout.SetBinding(VisualElement.BackgroundColorProperty, ".");
            var viewCell = new ViewCell { Height = 300, View = layout };

            return viewCell;
        }
    }

Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>