CarouselView is throwing dividebyzeroezception when i run the android version.

SanthoshKumar.0936SanthoshKumar.0936 INMember ✭✭
edited November 2017 in Xamarin.Forms

Hi, am developing a xamarin.Forms application and am using carousel view. it is working fine in iOS version but when i run the android version it is throwing dividebyzero exception. When i comment the CarouselView code in xaml it is not throwing any exception, it is running fine in android as well.Am using Xamarin.Forms.CarouselView nuget package version 2.3.0 pre-2. Can someone please help me out to solve this issue.
below is the code am using it in xaml


                        <BoxView Style="{DynamicResource BoxViewDefaultStyle}" />
                        <AbsoluteLayout 
                HorizontalOptions="Fill"
                VerticalOptions="Fill">
                        <StackLayout Padding="15,10,15,5" Spacing="3" 
                               AbsoluteLayout.LayoutBounds="0,0,1,1"
                 AbsoluteLayout.LayoutFlags="All" 
                 BackgroundColor="{DynamicResource OverlayBackgroundColor}" Orientation="Vertical">
                                                   <Image Source="Ico.png" WidthRequest="35" HeightRequest="35" HorizontalOptions="Center" />

                               <cv:CarouselView Position="{Binding StartPosition, Mode=TwoWay}" ItemsSource="{Binding Data}" HeightRequest="44">
                                    <cv:CarouselView.ItemTemplate>
                                        <DataTemplate>

                                                <Label TextColor="{DynamicResource LightTextColor}" LineBreakMode="WordWrap" FontSize="Micro" VerticalOptions="CenterAndExpand" 
                                                    Text="{Binding Text}" />

                                        </DataTemplate>
                                    </cv:CarouselView.ItemTemplate>
                                </cv:CarouselView>

                            <controls:CarouselIndicators HorizontalOptions="CenterAndExpand" IndicatorHeight="8" IndicatorWidth="8" UnselectedIndicator="IcoCarouselIndicatorUnselectedLightGray.png" SelectedIndicator="IcoCarouselIndicatorSelectedLightGray.png" 
                                                     Position="{Binding StartPosition, Mode=TwoWay}" ItemsSource="{Binding Data}" />
                        </StackLayout>
                             </AbsoluteLayout>
                        <BoxView Style="{DynamicResource BoxViewDefaultStyle}" />



                </StackLayout>

Thanks in advance.

Answers

  • seanydaseanyda GBMember ✭✭✭✭✭

    The Xamarin.Forms.CarouselView release is being replaced with @alexrainman version, and seems to be the go-to solution at the moment since the Xamarin one is still in pre-release and out of date.

    Replace your current CarouselView implementation with the one below and see if your still having issues.

    Github:
    https://github.com/alexrainman/CarouselView

    Nuget:
    https://www.nuget.org/packages/CarouselView.FormsPlugin/

  • ReemaGargReemaGarg INMember ✭✭
    edited November 2017

                    <cv:CarouselViewControl.ItemTemplate>
                    <DataTemplate>
                            <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
                            <Image Source="{Binding OnBoardImgSrc}" Margin="0,0,0,40" Aspect="AspectFit" HorizontalOptions="CenterAndExpand" VerticalOptions="Start"/>
                            <local:ExtendedLabel Text="{Binding OnBoardLabel1}" FontFace="London1960" FontSize="20" TextColor="{x:Static local:Constant.WHITE_TEXT_COLOR}" HorizontalOptions="CenterAndExpand" VerticalOptions="Start"/>
                            <local:ExtendedLabel Text="{Binding OnBoardLabel2}" FontFace="London1960" FontSize="20" TextColor="{x:Static local:Constant.WHITE_TEXT_COLOR}" HorizontalOptions="CenterAndExpand" VerticalOptions="Start"/>
                                </StackLayout>
                    </DataTemplate>
                </cv:CarouselViewControl.ItemTemplate>
            </cv:CarouselViewControl>
    
  • @ReemaGarg said:

                  <cv:CarouselViewControl.ItemTemplate>
                  
              </cv:CarouselViewControl.ItemTemplate>
          </cv:CarouselViewControl>
    

    Thanks for the reply. which nuget package are you using? Is it Xamarin.Forms.CarouselView or CarouselView.FormsPlugin?

  • ReemaGargReemaGarg INMember ✭✭
    edited November 2017
        <cv:CarouselViewControl x:Name="crslOnBoard" VerticalOptions="FillAndExpand"  HorizontalOptions="FillAndExpand" ShowIndicators="true" IndicatorsTintColor="Silver" CurrentPageIndicatorTintColor="White" IndicatorsShape="Circle">
    
  • seanydaseanyda GBMember ✭✭✭✭✭

    @SanthoshKumar.0936 said:

    @ReemaGarg said:

                    <cv:CarouselViewControl.ItemTemplate>
                    
                </cv:CarouselViewControl.ItemTemplate>
            </cv:CarouselViewControl>
    

    Thanks for the reply. which nuget package are you using? Is it Xamarin.Forms.CarouselView or CarouselView.FormsPlugin?

    They're using this one:
    https://github.com/alexrainman/CarouselView

    Because until it's merged into forms its named CarouselViewControl not CarouselView.

  • ReemaGargReemaGarg INMember ✭✭
    edited November 2017

    Use CarouselView.FormsPlugin and also add CarouselViewRenderer.Init(); in Main activity

  • AndreiMisiukevich_AndreiMisiukevich_ USMember ✭✭✭✭

    Hi)
    Try this
    nuget.org/packages/CardsView/ -- nuget
    github.com/AndreiMisiukevich/CardView -- source and samples

    @ReemaGarg

  • ManuelDambrineManuelDambrine GBBeta ✭✭

    @AndreiMisiukevich_ I can confirm your the cardsview control is the way to go! Solves all my problems. Thanks

  • AndreiMisiukevich_AndreiMisiukevich_ USMember ✭✭✭✭

    @ManuelDambrine thanks) enjoy it)

Sign In or Register to comment.