I layout nidificati in xamarin sembrano essere distorti a sinistra dello schermo. Presumo che questo sia un errore di arrotondamento da dp a pixel o qualcosa del genere?Layout di centratura con riempimento - errore di arrotondamento
Qualcuno può confermare, c'è un lavoro o una soluzione?
Sebbene il mio esempio utilizzi il layout Assoluto, il problema sembra essere su tutti i layout.
using System;
using Xamarin.Forms;
namespace XamarinTest
{
public partial class Page1 : ContentPage
{
public Page1()
{
InitializeComponent();
AbsoluteLayout child = layout;
AbsoluteLayout.SetLayoutFlags(child, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds(child, new Rectangle(0, 0, 1, 1));
Random rand = new Random();
for (int i =0;i<100; i++)
{
child = addLayout(child, rand) ;
}
AbsoluteLayout abs = new AbsoluteLayout();
AbsoluteLayout.SetLayoutFlags(abs, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds(abs, new Rectangle(0, 0, 0.5, 0.5));
abs.BackgroundColor = Color.Black;
layout.Children.Add(abs);
}
private AbsoluteLayout addLayout(AbsoluteLayout parent, Random rand)
{
AbsoluteLayout abs = new AbsoluteLayout();
AbsoluteLayout.SetLayoutFlags(abs, AbsoluteLayoutFlags.All);
AbsoluteLayout.SetLayoutBounds(abs, new Rectangle(0,0,1,1));
abs.Padding = new Thickness(2.0);
abs.BackgroundColor = new Color(rand.NextDouble(), rand.NextDouble(), rand.NextDouble());
parent.Children.Add(abs);
return abs;
}
}
}
XAML
<?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="XamarinTest.Page1">
<AbsoluteLayout BackgroundColor="White" x:Name="layout">
</AbsoluteLayout>
</ContentPage>
colpo dello schermo (se carica):
V interessante che dovrò controllare. Tuttavia, credo che abbiamo notato per la prima volta il problema su un dispositivo fisico (anche se avrebbe potuto essere una causa diversa) quali sono le schermate utilizzate dagli emulatori? – Ewan
Ps. Domanda completamente separata, i nostri test ios su cloud test hanno smesso di funzionare, non riescono più a trovare l'ID dell'accessibilità! (L'uso dell'ID di stile suggerisce codice dal sito .xamarin) Lo usi? Funziona per te? – Ewan
verificato doppio dispositivo, sei assolutamente corretto! – Ewan