gpt4 book ai didi

android - Xamarin.Forms TitleView FillAndExpand 不适用于 Android

转载 作者:行者123 更新时间:2023-11-29 23:25:37 27 4
gpt4 key购买 nike

我在 Xamarin.Forms 中创建了一个 TitleView。该 View 在 iOS 上有效,但在 Android 上它不会填满父 View :

红色区域是Tabbar的背景。 Aqua TitleView 的背景。对我来说,看起来有一些填充或边距?

这是我的标题 View :

    <ContentView xmlns="http://xamarin.com/schemas/2014/forms"                  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"                 xmlns:ffi="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"                 xmlns:fft="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations"                 x:Class="App.Views.TitleView"                 BackgroundColor="Aqua"                 HorizontalOptions=" FillAndExpand"                 VerticalOptions="FillAndExpand">        <ContentView.Content>            <Grid HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">                <Image Source="logo.png" HeightRequest="16" VerticalOptions="Center" HorizontalOptions="Center" ></Image>                <Grid HorizontalOptions="End">                    <Grid.ColumnDefinitions>                        <ColumnDefinition Width="auto"/>                    </Grid.ColumnDefinitions>                    <ffi:SvgCachedImage Source="Images/info.svg" HeightRequest="20" HorizontalOptions="End">                        <ffi:SvgCachedImage.Transformations>                            <fft:TintTransformation HexColor="#ffff0000" EnableSolidColor="true"/>                        </ffi:SvgCachedImage.Transformations>                        <ffi:SvgCachedImage.GestureRecognizers>                            <TapGestureRecognizer Tapped="infoIcon_Tapped" NumberOfTapsRequired="1" />                        </ffi:SvgCachedImage.GestureRecognizers>                    </ffi:SvgCachedImage>                </Grid>            </Grid>        </ContentView.Content>    </ContentView>

这是我的内容 View :

    <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"                xmlns:local="clr-namespace:App"                xmlns:pages="clr-namespace:App.Pages"                xmlns:extensions="clr-namespace:App.Code.Extensions"                xmlns:views="clr-namespace:App.Views"                xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"                x:Class="App.MainPage"                android:TabbedPage.ToolbarPlacement="Bottom">        <NavigationPage.TitleView>            <views:TitleView></views:TitleView>        </NavigationPage.TitleView>        <TabbedPage.Children>            ...        </TabbedPage.Children>    </TabbedPage>

最佳答案

你为什么不尝试这样的事情:

 <ContentView.Content>
<StackLayout Spacing="0" Orientation="Horizontal">
<Image Source="logo.png" HeightRequest="16" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand" ></Image>
<ffi:SvgCachedImage Source="Images/info.svg" HeightRequest="20" HorizontalOptions="EndAndExpand" VerticalOptions="CenterAndExpand >
<ffi:SvgCachedImage.Transformations>
<fft:TintTransformation HexColor="#ffff0000" EnableSolidColor="true"/>
</ffi:SvgCachedImage.Transformations>
<ffi:SvgCachedImage.GestureRecognizers>
<TapGestureRecognizer Tapped="infoIcon_Tapped" NumberOfTapsRequired="1" />
</ffi:SvgCachedImage.GestureRecognizers>
</ffi:SvgCachedImage>
</ContentView.Content>

关于android - Xamarin.Forms TitleView FillAndExpand 不适用于 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53627793/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com