应用 UI 中更新或新增功能的新功能标签

问题描述

我在 Xamarin.Forms 中开发了一个简单的应用程序。现在我定期推送新的更新,我想通知应用程序用户有关新功能的信息。我已经看到用户界面中新功能顶部的 NEW 标签出现了一段时间。 (请参见下面的屏幕截图)。 我想为我的应用实现相同的标签,但不知道该怎么做。 我有一种方法可以为我最近实现的所有功能手动添加标签,并在人们与这些功能交互后添加一个触发器来隐藏它们。但我认为这是一种将这些标签添加到所有特征的繁重方法。有没有合适的方法? 注意:我使用 Microsoft 应用中心向用户部署应用。

Android 10 UI

解决方法

例如:

这是您稍后将添加新标签的页面。

<?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="NewForms.Page12">
    <ContentPage.Content>
        <StackLayout x:Name ="stacklayout">
           <Label Text="Welcome to Xamarin.Forms!"
              VerticalOptions="CenterAndExpand" 
              HorizontalOptions="CenterAndExpand" />
              
        </StackLayout>
    </ContentPage.Content>
</ContentPage>


public YourPage()
    {
        InitializeComponent();
        MessagingCenter.Subscribe<YourPage>(this,"Add New Label",(sender) =>
        {
            // Do something whenever the "Add New Label" message is received
            Label newLabel = new Label() { Text = "new feature label" };
            stacklayout.Children.Add(newLabel );
        });
    }

假设这是你收到推送的回调方法:

void receive(){
   MessagingCenter.Send<YourPage>(this,"Add New Label");
}