【问题标题】:Xamarin.Forms.CarouselPage title colorXamarin.Forms.CarouselPage 标题颜色
【发布时间】:2014-09-08 07:23:18
【问题描述】:

我的移动应用程序中有一个使用 Xamarin.Forms 编写的代码:

public CarouselPage CreateMenuPage() {
    var menuPage = new CarouselPage();
    menuPage.Title = "Application name";
    menuPage.BackgroundColor = Color.White;
    return menuPage;
}

因此,页面标题是不可见的,因为它与背景具有相同的颜色(白色)。 CarouselPage 的标题如何设置自定义字体颜色?

【问题讨论】:

    标签: textcolor xamarin.forms


    【解决方案1】:

    页面标题不是不可见的,它不会显示为以模态方式打开或位于应用程序根目录的页面不显示标题。

    在 Xamarin 表单中,您可以在每个页面上设置标题,并且这些值由容器(如 NavigationPage、TabbedPage 等)在需要描述其子级时使用。任何打算添加到容器的页面都应该设置标题(至少)。

    例如,可以看到下面的测试标题,但看不到轮播内容页面标题。

        public static Page GetMainPage()
        {
            var MainPage = new MasterDetailPage();
            MainPage.Master = new ContentPage();
    
            MainPage.Detail = new NavigationPage(new CarouselPage
                {
                    Children = 
                    {
                new ContentPage {Content = new BoxView {Color = new Color (1, 0, 0)}, Title = "Page 1"},
                new ContentPage {Content = new BoxView {Color = new Color (0, 1, 0)}, Title = "Page 2"},
                new ContentPage {Content = new BoxView {Color = new Color (0, 0, 1)}, Title = "Page 3"}
                    },
    
                    Title = "test",
                });
            return MainPage;
        }
    

    【讨论】:

      猜你喜欢
      • 2013-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多