Xamarin后退按钮iOS和Android中的辅助功能名称

8e2ybdfx  于 2022-12-16  发布在  iOS
关注(0)|答案(1)|浏览(131)

在Xamarin表单中,如果你激活导航栏,显示页面的标题和一个箭头作为后退按钮,当你激活屏幕阅读器,后退按钮是焦点,对讲(Android)说“unlabeled button”.我知道如何设置通用元素的可访问性名称,但我不知道如何获得后退按钮元素,因为它不是一个示例.

relj7zay

relj7zay1#

如果使用 shell 导航,请创建CustomShellRenderer

[assembly: ExportRenderer(typeof(AppShell), typeof(CustomShellRenderer))]
namespace Droid.Renderers.CustomAppShell
{
    public class CustomShellRenderer : ShellRenderer
    {
        protected override IShellToolbarAppearanceTracker CustomToolbarAppearanceTracker()
        {
            return new CustomShellToolbarAppearanceTracker(this);
        }
    }
}
        
namespace Droid.CustomShell
{
    public class CustomShellToolbarAppearanceTracker : ShellToolbarAppearanceTracker
    {
        public override void SetAppearance(AndroidX.AppCompat.Widget.Toolbar toolbar, IShellToolbarTracker toolbarTracker, ShellAppearance appearance)
        {
            base.SetAppearance(toolbar, toolbarTracker, appearance);
            toolbar.NavigationContentDescription = "Custom Label Description”; // Set label here
        }
    }
}

相关问题