I modify the sample https://learn.microsoft.com/zh-tw/samples/xamarin/xamarin-forms-samples/userinterface-xaminals/ ,
replace the collectionview with listview . after replacing I found the listview cannot scroll to bottom (there are total 17 items , but only show 6 items)
This error only happen on Android,but it works well on IOS.
How to solve this problem?
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:Xaminals.Controls"
xmlns:data="clr-namespace:Xaminals.Data"
x:Class="Xaminals.Views.MonkeysPage"
Title="Monkeys">
<RelativeLayout
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Vertical"
VerticalOptions="FillAndExpand"
Padding="10">
<ListView ItemsSource="{x:Static data:MonkeyData.Monkeys}"
x:Name="CollectionView1"
RowHeight="100">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid VerticalOptions="CenterAndExpand" Padding = "20, 0" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image
Grid.RowSpan="2"
Aspect="AspectFill"
HeightRequest="60"
Source="{Binding ImageUrl}"
WidthRequest="60" />
<Label
Grid.Row="0"
Grid.Column="1"
FontAttributes="Bold"
Text="{Binding Name}" />
<Label
Grid.Row="1"
Grid.Column="1"
FontAttributes="Italic"
Text="{Binding Price}"
VerticalOptions="End" />
<Image Grid.Row="2" Grid.Column="0" Source="bear.png" HeightRequest="25" WidthRequest="25">
<Image.GestureRecognizers>
<TapGestureRecognizer
NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
<ActivityIndicator x:Name="activityIndicator" Color="Red" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.33}" RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height,Factor=0.33}" />
</RelativeLayout>
</ContentPage>
The solution is change the RelativeLayout to Stacklayout:
<StackLayout
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Vertical"
VerticalOptions="FillAndExpand"
Padding="10">
<ListView ItemsSource="{x:Static data:MonkeyData.Monkeys}"
x:Name="CollectionView1"
RowHeight="100">
.....
</ListView>
</StackLayout>
</StackLayout>
If you want to use RelativeLayout, you need to use XConstraint, YConstraint,WidthConstraint,HeightConstraint to layout the child view instead of VerticalOptions="FillAndExpand", HorizontalOptions="FillAndExpand".
Im' working on XAML view and I want to create simple view with left side bar and the content with Grid and inside grid I have some buttons, that I want to achieve is to fill all form
Code:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:App.ViewModels"
mc:Ignorable="d"
x:Class="App.Views.UserSelectionPage">
<ContentPage.Content>
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Vertical" BackgroundColor="#093145" HorizontalOptions="Start" VerticalOptions="FillAndExpand" >
<Label Text="AppName"
Grid.Row="0"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="Header"
TextColor="White"
Margin="15,0,10,15" />
</StackLayout>
<StackLayout Orientation="Vertical" VerticalOptions="End" BackgroundColor="#093145">
<Image Source="Assets/LargeTitle.scale-100.png"
Grid.Row="0"
Grid.Column="0"
HorizontalOptions="Center"
WidthRequest="90"
HeightRequest="90"
Margin="15,0,10,15"
VerticalOptions="Center"/>
</StackLayout>
</StackLayout>
<Grid BackgroundColor="AliceBlue">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!--<BoxView Color="#505CA9" Grid.Row="0" Grid.ColumnSpan="3" />-->
<Button Text="Use username instead"
Command="{Binding ToggleNewUserCommand}"
Grid.Row="0"
Grid.Column="2"
VerticalOptions="Center"
HorizontalOptions="End"
BackgroundColor="Transparent"
FontSize="Title"
TextColor="White"
Margin="15,0,10,15"/>
<Button x:Name="userOne"
d:Text="GQ"
Text="{Binding UserSelectionList[0].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userOne}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Margin="0,40,0,40"
Grid.Row="1"
Grid.Column="0"
BackgroundColor="{Binding UserSelectionList[0].BackgroundColor}"
d:BackgroundColor="#093145"/>
<Button x:Name="userTwo"
d:Text="LR"
Text="{Binding UserSelectionList[1].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userTwo}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Margin="0,40,0,40"
Grid.Row="1"
Grid.Column="1"
BackgroundColor="{Binding UserSelectionList[1].BackgroundColor}"
d:BackgroundColor="#107896" />
<Button x:Name="userThree"
d:Text="AR"
Text="{Binding UserSelectionList[2].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userThree}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Margin="0,40,0,40"
Grid.Row="1"
Grid.Column="2"
BackgroundColor="{Binding UserSelectionList[2].BackgroundColor}"
d:BackgroundColor="#829356" />
<Button x:Name="userFour"
d:Text="RR"
Text="{Binding UserSelectionList[3].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userFour}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Grid.Row="2"
Grid.Column="0"
BackgroundColor="{Binding UserSelectionList[3].BackgroundColor}"
d:BackgroundColor="#EBC944" />
<Button x:Name="userFive"
d:Text="GQ"
Text="{Binding UserSelectionList[4].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userFive}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Grid.Row="2"
Grid.Column="1"
BackgroundColor="{Binding UserSelectionList[4].BackgroundColor}"
d:BackgroundColor="#F26D21" />
<Button x:Name="userSix"
d:Text="GQ"
Text="{Binding UserSelectionList[5].Abbreviation}"
CommandParameter="{x:Reference userSix}"
Command="{Binding ButtonSelectedCommand}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Grid.Row="2"
Grid.Column="2"
BackgroundColor="{Binding UserSelectionList[5].BackgroundColor}"
d:BackgroundColor="#C02F1D" />
</Grid>
</StackLayout>
</ContentPage.Content>
Problem is for some reason it has free space inclusive if I use FillAndExpand on main StackLayout
I read about that but people just say that I missing FillAndExpand, I think problem is because I use Orientation="Horizontal" into first StackLayout, but that is the way I found to merge side bar with gridview. How can I achieve this? Regards
Add HorizontalOptions to the Grid itself:
<Grid HorizontalOptions="FillAndExpand" BackgroundColor="AliceBlue">
Some times when loading a View, it does not fully load on Iphone.. see the screenshot.. (Images are blurred on purpose..) At least, it does not load with proper dimensions. it is usually fixed by rotating the phone to landscape and back.. is there a way to avoid this?
here is my view:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:GalShare.ViewModel"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
xmlns:forms="clr-namespace:RedCorners.Forms;assembly=RedCorners.Forms"
mc:Ignorable="d"
x:Class="GalShare.Views.Gallery">
<NavigationPage.TitleView>
<Grid Padding="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="180"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="45"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Grid.Column="0" Text="Back" x:Name="Backbutton" Clicked="Backbutton_Clicked"></Button>
<Button Grid.Row="0" Grid.Column="2" Text="Ph. contact info" x:Name="PhInfo" Clicked="PhInfo_Clicked"></Button>
</Grid>
</NavigationPage.TitleView>
<ContentPage.Content>
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<StackLayout
AbsoluteLayout.LayoutFlags="All"
AbsoluteLayout.LayoutBounds="0,0,1,1">
<ContentView x:Name="Messagecontainer" Padding="5">
<forms:Frame2 CornerRadius="8"
HasShadow="True"
ShadowRadius="8"
ShadowColor="Black"
Padding="5"
BackgroundColor="LightGray">
<Label x:Name="Messagefield"></Label>
</forms:Frame2>
</ContentView>
<CollectionView ItemsSource="{Binding Galleries}" Margin="0" x:Name="MyCollection" SelectionMode="Single" SelectionChanged="CollectionView_SelectionChanged">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="Vertical"
Span="2" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<ContentView Padding="8">
<forms:Frame2 CornerRadius="15"
HasShadow="True"
ShadowRadius="5"
HeightRequest="190"
BackgroundColor="LightGray"
Padding="1">
<StackLayout HorizontalOptions="Start" VerticalOptions="Start" Padding="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ffimageloading:CachedImage Grid.Row="0" Grid.Column="0" x:Name="myImage" Source="{Binding ThumbUrl}" Aspect="AspectFit" CacheDuration="1" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" DownsampleToViewSize="False"></ffimageloading:CachedImage>
<StackLayout Padding="0" Margin="0" Spacing="0" Grid.Column="0" Grid.Row="1">
<StackLayout Spacing="0" Margin="0" Padding="5,0,5,0">
<ImageButton HorizontalOptions="Center" Padding="0" WidthRequest="28" Aspect="AspectFit" HeightRequest="28" Margin="0" Source="{Binding likeImg}" x:Name="Favoriteimage" Clicked="LikeButton_Clicked" ></ImageButton>
<!-- <Button CharacterSpacing="0" HorizontalOptions="Center" Padding="0" WidthRequest="50" HeightRequest="28" Margin="0" Text="Like" x:Name="Favoriteimage" Clicked="Button_Clicked" ></Button>-->
</StackLayout>
<Label x:Name="Picname" Text="{Binding ImageName}" IsVisible="{Binding showname}" FontSize="Micro" VerticalOptions="End" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" ></Label>
</StackLayout>
</Grid>
</StackLayout>
</forms:Frame2>
</ContentView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
<StackLayout IsVisible="{Binding isBusy}" x:Name="LoadingLayout" Padding="12"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1">
<ActivityIndicator IsVisible="{Binding IsBusy}"
IsRunning="{Binding IsBusy}" />
<Label Text="Loading gallery..." IsVisible="{Binding IsBusy}" HorizontalOptions="Center" TextColor="Black"/>
</StackLayout>
</AbsoluteLayout>
</ContentPage.Content>
</ContentPage>
Because you used AbsoluteLayout as root layout of the ContentPage . If you want to put the ActivityIndicator on the CollectionView , you could use Grid and put them in the same cell .
<Grid VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackLayout Grid.Row="0" Grid.Column="0" BackgroundColor="Red" x:Name="LoadingLayout" Padding="12">
//...
</StackLayout>
<StackLayout Grid.Row="0" Grid.Column="0" IsVisible="{Binding isBusy}" x:Name="LoadingLayout" Padding="12" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<ActivityIndicator IsVisible="{Binding IsBusy}"
IsRunning="{Binding IsBusy}" />
<Label Text="Loading gallery..." IsVisible="{Binding IsBusy}" HorizontalOptions="Center" TextColor="Black"/>
</StackLayout>
</Grid>
If the problem still exists, you could share your sample so that I can test it on my side .
Needed same design of the form. My coding is this Xamarin form, Xamarin iOS, Android
<Frame Grid.Row="0" Grid.Column="0">
<Image
HeightRequest="50"
Source="Dash01.png"
WidthRequest="50" />
<Label Text="Cow Milk"/>
</Frame>
<BoxView
HeightRequest="3"
HorizontalOptions="Fill"
VerticalOptions="Start"
Color="DimGray" Grid.Row="1" Grid.Column="0" />
Try this Code
<StackLayout
Padding="0,10"
BackgroundColor="#e8f5e4"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<CollectionView
x:Name="foodList"
Grid.Row="1"
Margin="12,0"
HorizontalOptions="FillAndExpand"
ItemSizingStrategy="MeasureAllItems"
SelectionMode="Single"
VerticalOptions="FillAndExpand">
<CollectionView.ItemsLayout>
<GridItemsLayout
HorizontalItemSpacing="5"
Orientation="Vertical"
Span="2"
VerticalItemSpacing="5" />
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame
Margin="5"
Padding="0"
BackgroundColor="Pink"
CornerRadius="10"
HorizontalOptions="FillAndExpand"
VerticalOptions="Fill">
<StackLayout
Margin="0,0,0,10"
Padding="10"
BackgroundColor="White"
HorizontalOptions="FillAndExpand"
VerticalOptions="Fill">
<Image
Aspect="AspectFit"
HeightRequest="50"
HorizontalOptions="Center"
Source="star.png" />
<Label
FontSize="18"
HorizontalOptions="Center"
HorizontalTextAlignment="Center"
Text="{Binding}" />
</StackLayout>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
These are my image:
the green one is over the yellow, I used a grid for it...But it makes that when I tap the green one the tap doesn't work...when they were not in the same position, the green image worked.
this problem happens only in iphone devices
my grid:
<Grid>
<Image BackgroundColor="Yellow" Margin="10,10,0,0" Source="cadastrarCliqueFoto" Grid.Row="0" Grid.Column="0"/>
<Image BackgroundColor="Green" Source="cadastrarVoltar" Margin="10,10,0,0" VerticalOptions="Start" Grid.Row="0" Grid.Column="0" HorizontalOptions="Start">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnClose"/>
</Image.GestureRecognizers>
</Image>
</Grid>
I've already tried 'InputTranparent = true' and it didn't work.
The complete code:
<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-
namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
x:Class="neoFly_Montana.PopUp.CadastrarPopup"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
xmlns:fftransformations="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations"
CloseWhenBackgroundIsClicked="False">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="9*"/>
<ColumnDefinition Width="0.5*"/>
</Grid.ColumnDefinitions>
<StackLayout Grid.Column="1" Spacing="0">
<RelativeLayout>
<StackLayout x:Name="stack_cadast" VerticalOptions="Center"
HorizontalOptions="FillAndExpand" BackgroundColor="White"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}"
RelativeLayout.HeightConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Height,
Factor=1,
Constant=0}">
<StackLayout.Spacing>
<OnPlatform x:TypeArguments="x:Double"
iOS="10"/>
</StackLayout.Spacing>
<Grid>
<Image BackgroundColor="Yellow" InputTransparent="true" Margin="10,10,0,0" Source="cadastrarCliqueFoto" Grid.Row="0" Grid.Column="0"/>
<ContentView Grid.Row="0" Grid.Column="0" Margin="10,10,0,0" InputTransparent="true" VerticalOptions="Start" HorizontalOptions="Start">
<Image BackgroundColor="Green" Source="cadastrarVoltar">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnClose"/>
</Image.GestureRecognizers>
</Image>
</ContentView>
<Button Grid.Row="0" BackgroundColor="Blue" Opacity="0.3" Grid.Column="0" Clicked="OnClose"/>
</Grid>
<Entry x:Name="cadastrar_entry_nome" PlaceholderColor="Black" Margin="20, 10, 10, 0" Placeholder="Seu nome completo" HorizontalOptions="Fill"/>
<Entry x:Name="cadastrar_entry_email" PlaceholderColor="Black" Margin="20, 10, 10, 0" Placeholder="E-mail" HorizontalOptions="Fill"/>
<StackLayout Orientation="Horizontal" Margin="20, 10, 10, 0">
<StackLayout Spacing="0">
<Label Text="Data de nascimento" HorizontalOptions="Center" FontSize="Micro"/>
<DatePicker x:Name="cadastrar_date_datanasc"/>
</StackLayout>
<StackLayout Orientation="Horizontal" Padding="0,0,20,0" VerticalOptions="Fill" HorizontalOptions="EndAndExpand" Spacing ="20">
<Image x:Name="cadastrar_img_fem" Scale="1" Source="femDisable">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="FemClique"/>
</Image.GestureRecognizers>
</Image>
<Image x:Name="cadastrar_img_masc" Scale="1" Source="mascDisable">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="MascClique"/>
</Image.GestureRecognizers>
</Image>
</StackLayout>
</StackLayout>
<StackLayout Orientation="Horizontal" Margin="20, 10, 10, 0">
<Picker x:Name="cadastrar_picker_estado" SelectedIndexChanged="PickerEstado_SelectedindexChanged" Title="UF"/>
<ActivityIndicator x:Name="cadastro_cidade_ind" IsVisible="False" IsRunning="True"/>
<Picker x:Name="cadastrar_picker_cidade" IsVisible="False" Title="Cidade"/>
</StackLayout>
<Entry x:Name="cadastrar_entry_senha" PlaceholderColor="Black" IsPassword="true" Margin="20, 10, 10, 10" VerticalOptions="End" Placeholder="Senha" HorizontalOptions="Fill"/>
<Label x:Name="cadastrar_lbl_feedback" FontSize="Micro" HorizontalOptions="Center" Margin="0,0,10,10" TextColor="Red" IsVisible="False"/>
<!--Botão Cadastrar-->
<ContentView Margin="0,20,0,0" Padding="20,20,20,20" BackgroundColor="#700B0F">
<ContentView.GestureRecognizers>
<TapGestureRecognizer Tapped="CadastrarClique"/>
</ContentView.GestureRecognizers>
<Label Text="Cadastrar" VerticalOptions="Center" FontSize="Large" HorizontalOptions="Center" TextColor="White" Style="{StaticResource labelsfont}"/>
</ContentView>
</StackLayout>
<Grid HorizontalOptions="FillAndExpand"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView,
Property=Y,
ElementName=stack_cadast,
Factor=1,
Constant=-42.5}"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="6*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center" WidthRequest="75" HeightRequest="75" Grid.Row="0" Grid.Column="1">
<ffimageloading:CachedImage BackgroundColor="Pink" VerticalOptions="End" HorizontalOptions="End" Source="cadastrarPhoto.png" x:Name="cadastrar_foto_perfil">
<ffimageloading:CachedImage.Transformations>
<fftransformations:CircleTransformation />
</ffimageloading:CachedImage.Transformations>
<ffimageloading:CachedImage.GestureRecognizers>
<TapGestureRecognizer Tapped="ChamaPickerImage"/>
</ffimageloading:CachedImage.GestureRecognizers>
</ffimageloading:CachedImage>
</StackLayout>
</Grid>
</RelativeLayout>
</StackLayout>
Try Absolute layout instead of grid.
<AbsoluteLayout>
<Image BackgroundColor="Yellow" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" Margin="10,10,0,0" Source="cadastrarCliqueFoto" />
<Image AbsoluteLayout.LayoutBounds="0,0,30,30" AbsoluteLayout.LayoutFlags="XProportional, YProportional" BackgroundColor="Green" Source="cadastrarVoltar" Margin="10,10,0,0" VerticalOptions="Start" HorizontalOptions="Start">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnClose"/>
</Image.GestureRecognizers>
</Image>
</AbsoluteLayout>
I was facing the same issue. I have put the second Image in ContentView like below and it's working for me.
<Grid>
<Image BackgroundColor="Yellow" Margin="10,10,0,0" Source="cadastrarCliqueFoto" Grid.Row="0" Grid.Column="0"/>
<ContentView Grid.Row="0" Grid.Column="0" Margin="10,10,0,0">
<Image BackgroundColor="Green" Source="cadastrarVoltar" VerticalOptions="Start" HorizontalOptions="Start">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnClose"/>
</Image.GestureRecognizers>
</Image>
</ContentView>
</Grid>
-------- UPDATED -------
XAML code
<Grid>
<Image BackgroundColor="Yellow" Margin="10,10,0,0" Source="cadastrarCliqueFoto" Grid.Row="0" Grid.Column="0"/>
<ContentView Grid.Row="0" Grid.Column="0" Margin="10,10,0,0">
<Image BackgroundColor="Green" Source="cadastrarVoltar" VerticalOptions="Start" HorizontalOptions="Start"/>
</ContentView>
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="Close_Tapped"/>
</Grid.GestureRecognizers>
</Grid>
Code behind
void Close_Tapped(object sender, System.EventArgs e)
{
throw new NotImplementedException();
}