TitleView not covering the entire toolbar

前端 未结 1 841
[愿得一人]
[愿得一人] 2021-01-29 03:28

I am developing notification count on Toolbar using TitleView. Inside TitleView I have used RelativeLayout which is

相关标签:
1条回答
  • 2021-01-29 03:45

    You can try this solution might be it is useful for you

    <?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.View.Page3">
    
        <NavigationPage.TitleView   >
            <StackLayout   BackgroundColor="Transparent">
                <Grid>
                      <Grid.RowDefinitions>
                         <RowDefinition Height="50"  />    
                      </Grid.RowDefinitions>
                      <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="100*"/>    
                      </Grid.ColumnDefinitions>
                       <Image Source="notification.png" Grid.Row="0" Grid.Column="0" HorizontalOptions="End" VerticalOptions="Center"   HeightRequest="25" WidthRequest="25"/>
                       <Frame Grid.Row="0" Grid.Column="0" HorizontalOptions="End" VerticalOptions="Center" Margin="0,-25,10,0"   CornerRadius="20"
                        Padding="-2"
                        BackgroundColor="White"
                        HasShadow="False">
                                 <Label  FontSize="10" HeightRequest="22" WidthRequest="23" Margin="1,1,1,1"    HorizontalTextAlignment="Center"  VerticalTextAlignment="Center"  BackgroundColor="Transparent" Text="100"
                             TextColor="Red"  x:Name="labelText"/>
                      </Frame>
                </Grid>
            </StackLayout>
    </NavigationPage.TitleView>
        <ContentPage.Content>
            <StackLayout >
                    <Label Text="Hello" />
                </StackLayout>
        </ContentPage.Content>
    </ContentPage>
    
    0 讨论(0)
提交回复
热议问题