xamarin-forms-carouselview icon indicating copy to clipboard operation
xamarin-forms-carouselview copied to clipboard

Issue on Android with latest version of Forms 2.2.0.31

Open mannyvw opened this issue 8 years ago • 14 comments

Hi

This was working great with older version of forms! Was going down a similar route, then found your code saving me loads of time. Good Work!

However our app I am integrating into uses latest version of forms. Works fine on iOS, but on android the line

_scrollView = (HorizontalScrollView)typeof(ScrollViewRenderer)
                    .GetField ("hScrollView", BindingFlags.NonPublic | BindingFlags.Instance)
                    .GetValue (this);

Am guessing ScrollView layed out differently in forms 2.2, how did you browse the properties to find the HorizontalScrollView?

thanks

N

mannyvw avatar May 23 '16 15:05 mannyvw

same problem.

QianPro avatar May 24 '16 10:05 QianPro

Anyone find a solution to this ? Have been trying all sorts of work arounds but nothing working :-(

mannyvw avatar May 31 '16 08:05 mannyvw

Also having this issue

Liam-Tait avatar Jun 01 '16 00:06 Liam-Tait

OK Fixed it. Name of property has changed to an _hScrollView. Easy when you know how!

    _scrollView = (HorizontalScrollView)typeof(ScrollViewRenderer)
                .GetField ("_hScrollView", BindingFlags.NonPublic | BindingFlags.Instance)
                .GetValue (this);

mannyvw avatar Jun 01 '16 08:06 mannyvw

Yes, it works now! Thanks @mannyvm!

QianPro avatar Jun 01 '16 09:06 QianPro

Thanks it works perfectly. Good work @mannyvw

JRolandros avatar Jun 04 '16 02:06 JRolandros

Works like a charm. Thank @mannyvw

RimVo avatar Jun 13 '16 10:06 RimVo

It work! Thank you.

ppongsakorn avatar Jun 14 '16 11:06 ppongsakorn

Many many thanks, it worked like a charm... :)

repper avatar Jul 11 '16 10:07 repper

I am still having trouble with the CarouselLayoutRenderer.cs At line 40 with latest code from git and latest Xamarin version the _scrollView is still null. What can I do?

twentytwokhz avatar Jul 22 '16 12:07 twentytwokhz

It's worth pointing out here that if you are on a version of Xamarin forms lower than 2.2.0.31, then the reverse of this applies. I.e. the original post by @mannyvw which contains the field "hScrollView" is the correct line, rather than "_hScrollView". The reason I point this out is that the code has been updated to include the newer field, so this code on older versions of forms will break.

Perhaps it might be ideal to check for the existence of the original, and then use the newer one, so that it works with both? Just a thought.

Either way, great post @mannyvw - this saved me a lot of time.

darylw avatar Mar 01 '17 11:03 darylw

Thanks . As an update in a new project I started I also needed a carousel view and there is actually an official from Xamarin now, it was supposed to be included in Xamarin Forms 2.3.0, but it was removed because of stability issues ? anyway it has its own NuGet instead. have been using it on android and ios for past few months and its been fine.

https://xamarinhelp.com/carousel-view-xamarin-forms/

NuGet is Xamarin.Forms.CarouselView

thanks

mannyvw avatar Mar 01 '17 12:03 mannyvw

Cheers for that - I had been keeping an eye on that, but the one thing that was crucial to this for me for UX reasons was the page indicators. This solution contains it from the start, and they are customisable as well, so was absolutely ideal. When Xamarin implement the indicators as well, then I may well switch over to theirs. Thanks for the prompt feedback - appreciated.

darylw avatar Mar 01 '17 12:03 darylw

Yeah my original UX had the pips too , i just did them programatically in forms, although they have been removed now. bloody designers ;-)

mannyvw avatar Mar 01 '17 15:03 mannyvw