I am using Xamarin HybridWebView to load url's inside the Xamarin.Forms application. It doesn't load the url in iOS devices. Can any one advice on this.
This is the code use to load url in xaml file:
<ContentPage.Content>
<local:HybridWebView x:Name="hybridWebView"
Uri="http://www.google.com"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand" />
</ContentPage.Content>
I have added the following key in info.plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Related
The code below when entered in AppShell for Xamarin Forms only works in Android. In iOS the Switch is rendered but can't be toggled (as if it is disabled). Are there any tricks to making this work in iOS as well or is this a bug?
I tried placing the the Switch in a completely different ContentView and loading it in the Shell with local: and also tried including the Switch in the DataTemplate directly. All of them work in Android, just not iOS.
Thanks for your help
<MenuItem>
<Shell.MenuItemTemplate>
<DataTemplate>
<ContentView>
<Switch IsToggled="True" />
</ContentView>
</DataTemplate>
</Shell.MenuItemTemplate>
</MenuItem>
I am developing a Xamarin Forms application for Android and iOS. Is it possible to use the new FlowDirection property introduced in Xamarin.Forms 3.0 to make the master details view from right to left including the menu which is presented from left as opposed to be from right in RTL languages?
I tried setting the MasterDetail page property but still the menu is presented from left in Android and the menubar is still from left to right.
Any ideas?
New property link
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Core/FlowDirection.cs
It seems to work out-of-the-box as expected on iOS but not on Android (extra actions required) with the next example:
<?xml version="1.0" encoding="UTF-8"?>
<MasterDetailPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="RTL.MasterDetailPage"
Padding="25"
FlowDirection="RightToLeft">
<MasterDetailPage.Master>
<ContentPage Title=" ">
<StackLayout>
<Button Text="Menu item" />
</StackLayout>
</ContentPage>
</MasterDetailPage.Master>
<MasterDetailPage.Detail>
<ContentPage>
<Label Text="My page"/>
</ContentPage>
</MasterDetailPage.Detail>
</MasterDetailPage>
Here is the outcome:
As you see on Android the menu appear on the left and on iOS on the right. Should check if there an existing bug report, if not should create a new one to the Xamarin.Forms team.
Update:
According to this document we have to add android:supportsRtl="true" to the application node in the manifest and ensure to set minSdk to 17+, without it won't work.So here is the final outcome:
I have a project that this without logo written only the name of the company, as the image below
enter image description here
now I want to put the company logo on the top of my project, to stay with a designer perfect, as you can see in the image below
enter image description here
I'm using xamarin forms and developing app for android and ios, how can I do this in my project? does anyone have any examples?
EDIT
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="projeto.Views.home"
x:Name="Name"
Title="Name" Icon="">
Here is a rough layout of what your page could look like:
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="projeto.Views.home"
x:Name="Name"
Title="Name" Icon="">
<!--Content page may only have one child element-->
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Orientation="Vertical">
<Image Source="CompanyLogo.png" AspectRatio="AspectFit"/>
<StackLayout>
<!--Other content--->
</StackLayout>
</StackLayout>
</ContentPage>
Note that this very basic approach is one of several. You need to familiarise yourself with xaml and the different components you could use to achieve certain things.
I am developing a simple xamarin forms application with one view in conjunction with Mvvmcross framework. Everything was going well, but in some point of time, I have noticed that Status bar and all system controls like Alerts, Navigation Bar, Back Button are increased in size in comparison to other apps (only on iOS platform). I have tried, without success, to revert all changes, but this bug remains still. Other test application, created using VS 2015 template is working fine. At Status bar size example this difference is clearly visible.
In the code, I just have a standard Mvvmcross setup with MainPage.xaml view which contains a ContentPage without any custom effects or renderers.
iOS Setup.cs
protected override IMvxIosViewPresenter CreatePresenter()
{
Forms.Init();
var xamarinFormsApp = new App();
return new MvxFormsIosPagePresenter(Window, xamarinFormsApp);
}
iOS AppDelegate
[Register("AppDelegate")]
public partial class AppDelegate : MvxApplicationDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
var window = new UIWindow(UIScreen.MainScreen.Bounds);
var setup = new Setup(this, window);
setup.Initialize();
var startup = Mvx.Resolve<IMvxAppStart>();
startup.Start();
window.MakeKeyAndVisible();
return true;
}
}
iOS Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>XamarinFormsApp</string>
<key>CFBundleIdentifier</key>
<string>com.test.xamarintest</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CFBundleIconFiles</key>
<array />
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>9.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
</dict>
</plist>
I have found the problem. The reason, why this had happened, is that I used splash screen still images instead of storyboard approach. I do not understand why iOS doing such controls size scaling but the solution is to remove that images and use storyboard approach for launch screens.
P.S. Thanks to Gerald Versluis reply. It has guided me in the right direction.
Im trying to display an image on a kindle fire device using a Xamarin project.
The kindle device is android API level 15.
Ive tried to display the image using both URI and local resource techniques but both being used by XAML rather then code behind.
XAML code behind:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AbsoluteLayoutExercise.Exercise2">
<StackLayout>
<Image Source="Lily2.png" />
</StackLayout>
</ContentPage>
With PNG image (saved using MSPaint to make sure that it is an actual PNG) saved into resources/Drawable on the Android project.
XAML uri
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="AbsoluteLayoutExercise.Exercise2">
<StackLayout>
<Image Source="http://lorempixel.com/1920/1080/nature/7" Aspect="AspectFill" />
</StackLayout>
</ContentPage>
Both these ways build successfully but when deployed to the device in question, i get nothing but a white screen.
Anyone got any words of advice?