Is there a Slide Image Gallery for Xamarin Android? - xamarin

I am looking for a image gallery to use on Xamarin Android for a app i am creating but cant cant find any Gallery that slides left or right, Cant even find any blogs post on creating it to
I found a this one for Android its Called Android Image Slider
https://github.com/daimajia/AndroidImageSlider
But I cant open it Xamarin Studio
Also I am using the free version of Xamarin Studio
Is there any way i can achieve this using Xamarin?

I have implemented a image slider in xamarin android using FragmentStatePager adapter. You need three things
1) Main Activity which implements Adapter (Point #2)
2) Implementation of FragmentStatePagerAdapter for items and instantiate the fragment class (Point#3).
3) You need to implement fragment and set the image on the view. This fragment is then instantiated from the FragmentStatePagerAdapter and displayed on the screen as you scroll.
All you have to do count the no.of images you have in library and then on the activity, you need to shift the images on the view pager at certain time interval.
//displaying image for 2 seconds
Thread.Sleep (2000);
//Updating the view pager with the next image.
this.RunOnUiThread (() => _pager.SetCurrentItem (imageValue, true));
SetCurrentItem method on viewpager will show the display of the fragment.
Full Example and explanation in detail is available on Code Project
http://www.codeproject.com/Tips/1038358/Xamarin-Android-Image-Auto-Slider-and-OOM-Issue-Ha
Source code can be downloaded from my GIT HUB.
https://github.com/sahilkhan99/learnings/tree/master/autoImageSlider
Cheers

Related

xamarin forms start nativ uwp page

any idea how I can start a native UWP page from a Xamarin Forms page?
The reason why I'm asking:
I have a XF application that needs to start a UWP library after a click event.
This library provides a special ORC reader.
Therefore I created a dependency service to run the platform specific function.
What I need now, is to open that UWP page, that contains the "Camera stream" to show the user what he is currently scanning.
And this is where I am hanging at the moment.
In my class that is called from the dep. service, I
myPage mp = new myPage();
But how can I show the new page?
Frame fr = Window.Current.Content as Frame gives me the error, that this page cannot be converted from a XF Frame to a Window Frame.
Or is there generally another way to handle this? Some advice would be great.
This sounds like a custom renderer.
Create a new OcrView class in your shared project inherited from View.
Place it on your Xamarin Forms XAML page.
Handle the OCR component in the UWP renderer.
Have a look at the Implementing a View section on this custom renderer overview

How to use font awesome icon or google icon (material icon) in grid view of android xamarin.

I am new in Android and Xamarin . i have grid view with image and text view in my xamarin (android) application . but i wont to use font awesome icon or material icon in place of image in grid view reason behind that is reduce size of application.i try this NuGet package but it's not work for me "https://www.nuget.org/packages/FontAwesome.Xamarin/"
but i don't found proper tutorial for that. so please help me for that and i have one another doubt when i use icon in place of .png so it's help me for reducing size of application or not??

Skia view element in xamarin.forms

I'm trying to draw new elements/images via the new skiasharp library for xamarin forms.
I got the samples working but they only change the full content page with the new canvas.
So my question would be how to implement a single view which can be placed in any place in another content page. Does anyone have experiences with skia?
How do I choose the canvas? Do I have to overwrite an existing Image or similar?
Thanks for you help.
Sure, and there is a view which you are looking for: SkiaView.
It inherited from Xamarin.Forms.View and contains some properties such as HeightRequest or Scale.
I suppose you are interested in these classes:
SkiaView
ISkiaViewController
iOS - SkiaViewRenderer
iOS - NativeSkiaView
Android - SkiaViewRenderer
Android - NativeSkiaView
EDIT:
Finally there is a NuGet package with Xamarin.Forms support: SkiaSharp.Views.Forms 1.54.1-beta1. Samples are available in SkiaSharp repository.

Xamarin - how to center a launch screen image (iOS)?

I'm using Xamarin for Visual Studio, and am getting frustrated trying to do what I would think should be a very simple thing: creating a launch (splash) screen for iOS, that has a single image that is centered on the screen (vertically and horizontally centered).
I'm creating it the recommended way, using a storyboard (other methods, like using an assets catalog, are considered deprecated as of iOS 9). In the storyboard, I have a View Controller, which contains a View, which contains an Image View. In the Properties pane, I've tried messing with the Mode (in Widget tab), and I've tried playing around with contstraints - which I think might be the key, but it is difficult to understand how it all works together.
You need to add the Splash screen in the applications properties (Launch Images). You need to create the image and upload it via that section. I couldn't find anything saying that the use of Asset catalogues are depreciated.

Xamarin.Forms custom loading gif as activity indicator

I would just like to know of something is possible as I am very new to Xamarin and I am on a time limit for an assignment. I don't mind some trial and error, but don't want to waste the time if it isn't possible
I want to have an animated gif as an activity indicator (it is a logo).
I have it working in a WebView - is it possible, in Xamarin,Forms to have this appear as an overlay while waiting on long running methods?
For example. if user clicks on a button, the app gets some info from a webservice then displays in a page. While waiting I would like to show the webview (or any other way to show an animagted gif).
So I am not asking for the code, but just if it is posible.
Thanks in advance
I was able to work this out
With the animated(loading) gif running in the WebView page I called a couple of async methods using following
await Task.WhenAll(method1(), method2());
await Navigate.PushAsync(new NextPage(var1, var2));
The laoding gif (which is an animated logo) runs until the tasks are complete then navigates to the next page
Using an ImageView apparently this doesn't look like its possible to playback animated Gif's as can be seen here http://forums.xamarin.com/discussion/17448/animated-gif-in-image-view.
So i very much doubt the ActivityIndicator would, if it could. In the ActivityIndicator I can't see any functionality to change the content of the what is shown when it is busy.
You could always create your own animated image view by creating a custom renderer instead however. It isn't particularly hard to cycle images at pre-determined gaps if you have a list of the images split up.
GIF images can be used in Xamarin forms to show custom activity indicator, since in Xamarin forms it is not possible to show GIF images directly web-view must be used. For android image must be placed inside assets folder and Build Action must be set to AndroidAsset. For iOS image must be placed inside resources and Build Action must be set to BundleResource. AbsoluteLayout can used for placing the image to center, IsBusy property of mvvm helpers nuget can used for controlling the visibility of the activity indicator. Dependency service must used for getting the image path. You can check this https://github.com/LeslieCorrea/Xamarin-Forms-Custom-Activity-Indicator for example.
Xamarin.Forms now supports .GIF, from version 4.4-pre3 and up on iOS, Android and UWP. Before using, first add the .GIF to the platforms projects, or as an embedded resource in the shared project and then use it like a regular image. The API on the Image control has been extended with the IsAnimationPlaying bindable property.
For e.g., loader.gif is added in all platform projects, then below code make it animating.
<Image Source="loader" IsAnimationPlaying="True" WidthRequest="36" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" />

Resources