i am trying to get Webview inside Flipview, so as usual it will be something like this :
<flipview>
<flipview.itemtemplate>
<datatemplate><webview name="wv" /> </datatemplate>
</flipview.itemtemplate>
</flipview>
I would like to use wv.navigatetostring(htmlstring);
The problem now is, when i navigate through items, sometime the webview is updated, sometime its not. Any Suggestion?
Theoretically it is possible to use WebView inside FlipView, but you should be aware of several limitations of this component. There is a well known issue when using the WebView - it's rendered on top of everything so the swiping using touch between FlipView items might not be possible.
Nice article every developer should know before using WebView in Windows 8 application:
Ten Things You Need to Know About WebView
Related
I'm using Shell in my Xamarin Forms app together with a bottom tabbar and no flyout menu.
Is it somehow possible to have a static view/control between the content page and the bottom tabbar?
(As an example, look at Spotifys mini-player that's constantly shown above the bottom tabbar)
I have tried to use a ControlTemplate in the ContentPage, but it works so-so.
When navigating between pages, the entire view is "slided away", thus it's noticeable that the control is not static and instead instantiated per each page.
Deactivating animations partially solves it but makes the application feel very static and is thus not an acceptable solution.
Anyone got an idea of how this can be solved?
It's quite easy to solve it with Xamarin.Android and Xamarin.Ios, but this needs to be done in Xamarin Forms.
Thanks in advance.
I am developing an app like Ola and Uber which will have navigation system and live tracking inside my Xamarin Forms app (For Android and iOS both platforms). So, can anyone please tell me the way to open the navigation map inside the app?
If you are trying develop an app like Ola/Uber which will have navigation system and live tracking inside the app, then you don't need to open the navigation map inside the app. You just need to display it on the page.
You can follow the official Xamarin.Forms documentation here, to add maps into your Xamarin Forms app. There's a full fledged map sample that you can also see to understand what needs to be done, but your XAML will look something like this:
<ContentPage ...
xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps">
...
<maps:Map x:Name="map" />
...
</ContentPage>
The 3 dots indicate other controls you would like to add into the page and the layout that you have to put the Map control inside.
In fact you can also take a look at the sample code of several apps (RunAway, YellowClone, SmartHotel, BikeSharing, Movies, Evolve) in Javier Suarez's Good Looking UI curated collection.
I have a Mac app that displays info in a WebView. Quite an old app now and in Objective-C which I am rapidly forgetting.
The WebView contains anchor tags to allow navigation within the pages, both by clicking on links in the page displayed, or by clicking tabs in the UI which send Javascript to the WebView. In High Sierra this no longer works although it displays no error.
It appears that I need to implement isKeyExcludedFromWebScript: but my attempts to do so have failed.
Do I need to sub-class WebView? Putting isKeyExcludedFromWebScript: and isSelectorExcludedFromWebScript: in the View Controller containing the WebView doesn't work - they never get called.
If anyone has any advice or examples, I would be most grateful.
I am afraid that the answer will be to upgrade the app to use WKWebView but I was hoping for a quick work-around until I get time to do that.
Answering my own question here as I have worked out a solution.
The problem was that I was loading an HTML string into the WebView and when I tried to use internal navigation links, it didn't have a base URL to use as a prefix and so the anchor navigation never worked.
It used to work, prior to High Sierra, so there must be something new about how WebViews operate.
The solution was to save the HTML string to a temporary file and have the WebView load that file's URL instead of loading the string directly.
This applies to both WebView and WKWebView.
So, I am developing an application that uses 2-3 WebView, and the performance hit when the user open them is huge: I can't remove them and use native views to show the data because it was requested to use a WebView, so I was looking for a way to embed a page that was less performance hungry.
Thanks for the help ;)
Example:
webview.xml
<Alloy>
<Window id="webview">
<WebView id="dynamicWebView" />
</Window>
</Alloy>
webview.js
$.dynamicWebView.url = "http://www.stackoverflow.com";
$.webview.open();
There is an alternative called Crosswalk:
https://github.com/UniversalAvenue/TiCrosswalk
it brings the latest Chromium to all Android devices (even older ones that don't use the external WebView component). But I'm not sure if that brings you some memory advantages since it's still a webview. But give it a try!
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" />