【问题标题】:Xamarin.forms : how to add a gradient color for tabbarXamarin.forms:如何为标签栏添加渐变色
【发布时间】:2018-06-14 00:58:17
【问题描述】:

在 xamrin froms 应用程序中,我们有一个标签栏,我们需要在 iOS 和 android 设备中为该标签栏添加一些渐变颜色。我们怎么能这样?

【问题讨论】:

    标签: android ios xamarin.forms uitabbar


    【解决方案1】:
    1. 由您的设计师制作具有渐变色的图像;
    2. 将其应用于标签栏,如:

      UITabBar.Appearance.BackgroundImage = image;

    官方文件: https://developer.xamarin.com/api/type/UIKit.UITabBar+UITabBarAppearance/

    【讨论】:

    • 对安卓有什么建议吗?
    • 以Android为例,tabbar布局在 Ressources/layout/Toolbar.xml ,使用:android:background="@drawable/yourImage"
    • 图像适用于 iOS,但存在大小问题。如果在 iOS 原生 UITabBar.appearance().contentMode = .ScaleAspectFit 中找到这个。但无法在 Xamarin froms app delegate 中找到内容模式。有什么建议吗?
    猜你喜欢
    • 2018-12-23
    • 2021-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-11
    • 2021-11-20
    • 2018-06-18
    相关资源
    最近更新 更多