Search code examples
androidxamarin.formscarousellandscape

CarouselView Xamarin forms indicator view not showing


Im trying to see the indicator views , but for some reason I cant see them , also , I tried horizontals options : fill and expand , it does work on ios on landscaping orientation.However, I cant get it to expand when the android is on landscape

this is what I have

<StackLayout HorizontalOptions="FillAndExpand">
   <CarouselView EmptyView="No items to display."  IndicatorView="indicatorView" ItemsSource="{Binding CarouselImages}">
    <CarouselView.ItemTemplate>
        <DataTemplate>
            <StackLayout HorizontalOptions="StartAndExpand" >
                 <Image Source="{Binding ImagePath}"
                               Aspect="AspectFill"
                               HorizontalOptions="StartAndExpand" />
              </StackLayout>
        </DataTemplate>
    </CarouselView.ItemTemplate>
</CarouselView>
     <IndicatorView x:Name="indicatorView"
                    IndicatorsShape="Square"
                     MaximumVisible="6"
                   IndicatorColor="DarkRed"
                   SelectedIndicatorColor="DarkGray"
                   HorizontalOptions="Center" />

     </StackLayout>

Solution

  • Give it a size , for example IndicatorSize="12"

    https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/indicatorview#change-indicator-size

      <IndicatorView
                x:Name="indicatorView"
                HorizontalOptions="Center"
                IndicatorColor="DarkRed"
                IndicatorsShape="Square"
                MaximumVisible="6"
                IndicatorSize="12"
                SelectedIndicatorColor="DarkGray" />
    

    enter image description here

    enter image description here