Xamarin.Forms TitleView FillAndExpand не работает с Android - PullRequest
0 голосов
/ 05 декабря 2018

Я создал TitleView в Xamarin.Forms.Представление работает на iOS, но на Android оно не заполнит родительский элемент:

image

The red area is the background of the Tabbar. Aqua the background of the TitleView. For me, it looks like there is some padding or margin?

This is my title 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>

1 Ответ

0 голосов
/ 05 декабря 2018

Почему бы вам не попробовать что-то вроде этого:

 <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>
...