相关疑难解决方法(0)

如何更改<StackLayout> <Grid>屏幕以使用<RelativeLayout>?

我有这个代码,目前是和的组合

我想转向相对布局,并没有看到这么多的例子.将不胜感激任何关于如何实现这一目标的建议.

关于XAML的一些观点.

  • screenGrid或phraseGrid出现在屏幕上
  • buttonGrid或tapGrid都会出现在屏幕上
  • 按钮的垂直中心和水龙头标签应该是相同的位置.因此,当按钮未显示时,点击标签出现在与按钮相同的垂直按钮上.
  • 框架显示在选项卡页面内

我意识到这不仅仅是一个简单的问题,但我相信其他人会感兴趣.由于答案可能非常复杂,我将在几天内为此开出250点奖金.

    <Grid x:Name="emptyGrid" Grid.Row="1" Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
        <StackLayout Padding="10,0,10,0" HorizontalOptions="Center" VerticalOptions="Center">
            <Label x:Name="emptyLabel" FontSize="18" XAlign="Center" TextColor="Gray" />
        </StackLayout>
        <Button x:Name="resetButton" Text="Reset points?" TextColor="White" FontAttributes="Bold" FontSize="20" HeightRequest="60" BackgroundColor="#E19A3F" HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand">
            <Button.FontSize>
                <OnPlatform x:TypeArguments="x:Double" iOS="25" Android="20" />
            </Button.FontSize>
        </Button>
    </Grid>

    <Grid x:Name="phraseGrid" Padding="20, 20, 20, 20" BackgroundColor="Transparent" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
        <Grid.RowDefinitions>
            <RowDefinition Height="6*" />
            <RowDefinition Height="6*" />
            <RowDefinition Height="80*" />
            <RowDefinition Height="13*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Grid x:Name="prGrid" Grid.Row="0" Grid.Column="0" 
            Padding="5,0,0,0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" …
Run Code Online (Sandbox Code Playgroud)

xamarin xamarin.forms

14
推荐指数
1
解决办法
427
查看次数

是否可以在XAML(Xamarin.Forms)中混合使用OnIdiom和OnPlatform?

对于UWP,我需要一个不同大小的列的宽度Grid.此外,平板电脑和智能手机的价值应该不同.

以下代码崩溃了应用程序

<ColumnDefinition>
    <ColumnDefinition.Width>
        <OnIdiom.Phone>
            <OnPlatform x:TypeArguments="GridLength" iOS="*" Android="*" WinPhone="100" />
        </OnIdiom.Phone>
        <OnIdiom.Tablet>
            <OnPlatform x:TypeArguments="GridLength" iOS="*" Android="*" WinPhone="200" />
        </OnIdiom.Tablet>
    </ColumnDefinition.Width>
</ColumnDefinition>
Run Code Online (Sandbox Code Playgroud)

在xmlns http://xamarin.com/schemas/2014/forms中找不到OnIdiom.Phone

代码在ViewCell.所以我不能使用额外的ResourceDictionary,也OnSizeAllocated()不能在代码隐藏文件中使用.

是否有可能使用OnIdiomOnPlatform在一起?

xaml mobile-devices xamarin xamarin.forms mobile-development

12
推荐指数
2
解决办法
5455
查看次数