如何在Xamarin表单的按钮内添加不同类型的TextSize? [英] How to add Different type of TextSize inside a button in xamarin forms?

查看:67
本文介绍了如何在Xamarin表单的按钮内添加不同类型的TextSize?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个按钮,该按钮具有两个具有不同TextSize的文本. 这是样本

I want to add a button which have Two Text with different TextSize. here is the sample

该怎么做?

推荐答案

而不是按钮,为什么不做类似boxview的文本,将文本添加为​​具有不同文本大小的标签,然后给该框点按手势?

rather than a button why don't you make it something like a boxview, add your text as labels with different text sizes, then give the box a tap gesture?

将此添加到OnAppearing

add this in OnAppearing

var my_tap = new TapGestureRecognizer();
my_tap.Tapped += (s, e) =>
     {
         // do your thing;
      };
YourBoxView.GestureRecognizers.Add(connect_tap);

或StackLayout:

Or a StackLayout:

<StackLayout x:Name="buttonStack" BackgroudColor="Blue">
            <StackLayout.GestureRecognizers>
                <TapGestureRecognizer Tapped="YourCode"></TapGestureRecognizer>
            </StackLayout.GestureRecognizers>
    <Label FontSize="Large">your text</Label>
    <Label FontSize="Small">your other text</Label>
</StackLayout>

这篇关于如何在Xamarin表单的按钮内添加不同类型的TextSize?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆