locked
Changing font size of a text in toolbar item RRS feed

  • Question

  • User369433 posted

    How can I change the font size of a toolbar item? I was searching for a long time over the Internet and Android documentation and still I cannot find that. I think this shouldn't be difficult because i.e. changing the text color of a toolbar item is easy. You just have to add:

    <item name="android:actionMenuTextColor">@color/actionbar_text</item>
    

    in styles.xml and that's all.

    Friday, June 22, 2018 7:49 PM

Answers

  • User344025 posted

    How can I change the font size of a toolbar item? I was searching for a long time over the Internet and Android documentation and still I cannot find that.

    There is another post just like this: https://forums.xamarin.com/discussion/comment/225640/ That does involve a custom renderer - but you can look at their GitHub

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, June 22, 2018 9:21 PM

All replies

  • User57571 posted

    This will require a CustomRenderer of a Xamarin.Forms.NavigationPage.

    Friday, June 22, 2018 8:56 PM
  • User369433 posted

    Seriously? This cannot be done in styles.xml? Or if the custom renderer is required, can somebody post example implementation?

    Friday, June 22, 2018 9:04 PM
  • User344025 posted

    How can I change the font size of a toolbar item? I was searching for a long time over the Internet and Android documentation and still I cannot find that.

    There is another post just like this: https://forums.xamarin.com/discussion/comment/225640/ That does involve a custom renderer - but you can look at their GitHub

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, June 22, 2018 9:21 PM
  • User369433 posted

    Unfortunately, they did not provide any clear answer.

    Friday, June 22, 2018 9:30 PM
  • User370441 posted

    I created a custom content in the TitleView of the shell. Below the code:

    <Shell.TitleView>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="8*" />
                <ColumnDefinition Width="2*" />
            </Grid.ColumnDefinitions>
    
            <StackLayout Grid.Column="0" Orientation="Horizontal" Padding="5,5,5,5" HorizontalOptions="Start">
                <Label Text="&#xf007;" FontSize="28" FontFamily="FontAwesome" TextColor="White" Padding="0" HorizontalOptions="Center" VerticalOptions="Center" HorizontalTextAlignment="Center" />
                <Label Text="Perfil" HorizontalOptions="Start" VerticalOptions="CenterAndExpand" TextColor="White" FontSize="22" FontAttributes="Bold" />
            </StackLayout>
            <StackLayout Grid.Column="1" Orientation="Horizontal" HorizontalOptions="Start" VerticalOptions="Center">
                <Label Text="&#xf044;" FontSize="14" FontFamily="FontAwesome" TextColor="White" VerticalOptions="Center" >
                    <Label.GestureRecognizers>
                        <TapGestureRecognizer Tapped="EditarPerfil" />
                    </Label.GestureRecognizers>
                </Label>
                <Label Text="Editar" FontSize="14" TextColor="White" VerticalOptions="Center" >
                    <Label.GestureRecognizers>
                        <TapGestureRecognizer Tapped="EditarPerfil" />
                    </Label.GestureRecognizers>
                </Label>
            </StackLayout>
        </Grid>
    </Shell.TitleView>
    
    Thursday, December 24, 2020 3:37 PM