I will try to render some svg's in xamarin forms.
But the existing svg's are written in snap.svg.
Give it a nice why to render such svg's in xamarin forms?
Thank you.
Snap is used for animating svgs in web. You can't use the snap animations of svg in xamarin UI, because they are javascript animations. If you need just the svg, without the animation, you can export the inner svg (take a look here) and then use TwinTechs.SvgImage library for rendering cross-platform svgs in your xamarin.forms application.
EDIT 1:
You can load the svg into a WebView. I've created a sample project, which you can find here.
I've used XLabs's HybridWebView control. It allows to load html into web view. The rest is straightforward. You need to add HTML folder to iOS and Android projects (root project directory and Assets directory respectively). For iOS you need to copy HTML directory manually as described in HybridWebView doc
HybridWebViewRenderer.CopyBundleDirectory("HTML");
Then in your xaml page you declare the web view
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:XLabs.Forms.Controls;assembly=XLabs.Forms"
x:Class="SvgSample.Views.SvgPage"
BackgroundColor="White">
<controls:HybridWebView
x:Name="webView"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand" />
</ContentPage>
And in xaml.cs file you need to load HTML into the web view in OnAppearing method (this is important, otherwise it will not work, again check out HybridWebView doc)
protected override void OnAppearing()
{
base.OnAppearing();
webView.LoadFromContent("HTML/guage.html");
}
I've tested for iOS and Android and it worked.
Related
Which one is Best for my Android Tutorial App (pdf viewer or web viewer) . Its a Programming tutorial app so which component i use for my app? or another suggestion to develop tutorial app.
I use pdf viewer instead of webview because pdf show all image or content offline but webview is not showing the images offline. One more Problem occur to creating a block for code between pdf.
If you have prepared your content in word/doc/pdf then the pdf viewer is best.
If you have prepared your content in HTML like web pages or website, it's best to go with the webview.
I am creating a mobile app for android and ios using xamarin and MVVMCross.
In android I have created a tabbed page with 3 tabs using viewpager and toolbar.I have menuitems in the toolbar like Save,Sync etc. on click of which will save the content in each of the 3 tabs back into the database.
I want to implement the same in xamarin.ios but I see one problem here because if I create a tabbed page in ios using MvxTabBarController I am not sure if I can implement a similar concept of toolbar with menuitems where the menuitems will remain common across three tabs.
I am using MvvmCross so I have a MainViewmodel binding to MainViewController which will create 3 tabs for three child Viewmodels further having their respective Viewcontrollers attached.
In short my goal is to achieve the same I did for android application having common menuitems across 3 tabs.
Can anyone please help .....This is my first ios application !!
Thanks,
Santosh
I am building an app which loads an SVG file (2D Floor plan) and then I need to add click events for each room, table, chair, etc...
I am using normal HTML / Javascript for the website and for the app I am testing the XamSVG component but I am not sure that is the right tool for it.
Any ideas? Can I use WebView? There are other packages available?
Thanks
I need to know that I have weather App and UI for this Weather App in CSS, Psd etc. My query is how can I add this UI (Psd/CSS) with my Weather App in Android Studio. If anyone know please show me step by step.
Psd is not gonna work. You have to 'translate' this in a XML file in order to view in Android Studio... another way is just transform the psd in pngs and jpegs file (only for views, to edit you should separate all graphical componentes).
Css is other thing, other way. You can use Css in a WebView component, the main reference to guide is: https://developer.android.com/guide/webapps/webview.html
Hope it helps.
I've created a very simple ASP.NET 4.5 MVC4 web site which uses OpenLayers 2.12. It's got only one page that shows a map with a few points and lines on it. If I run it locally, it runs fine, but after publishing to my Azure Web Site, the OpenLayers' CSS files won't load. I have now added the OpenLayers CSS hard coded in my bundleConfig, and now it works fine. But of course, this is not what I want, because OpenLayers has specific CSS files for other platforms and browser versions etc.
Locally, I just have to include openlayers.js and OpenLayers then adds the right css files. Does anybody know why this doesn't work after publishing to Azure?
From the docs in openlayers.js:
Please remember that when your OpenLayers script is not named
"OpenLayers.js" you will have to make sure that the default theme is
loaded into the page by including an appropriate <link>-tag,
e.g.:
(code)
<link rel="stylesheet" href="/path/to/default/style.css" type="text/css">
(end code)
Because Azure changes the file names that are included, I indeed should be adding the reference to the default style myself. Also, I can just link to style.css, the other css files for e.g. IE6 or Mobile won't be uses automatically, these are just there for yourself to use it when appropriate.