共用方式為


iOS 上的 TabbedPage 半透明索引標籤

此 iOS 平臺特定是用來設定 上 TabbedPage索引標籤的半透明模式。 將可繫結屬性設定 TabbedPage.TranslucencyModeTranslucencyMode 列舉值,以在 XAML 中取用:

<TabbedPage ...
            xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
            ios:TabbedPage.TranslucencyMode="Opaque">
    ...
</TabbedPage>

或者,您可以使用 Fluent API 從 C# 取用它:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
...

On<iOS>().SetTranslucencyMode(TranslucencyMode.Opaque);

方法 TabbedPage.On<iOS> 會指定此平台專屬只會在iOS上執行。 在 命名空間中,方法TabbedPage.SetTranslucencyMode可用來藉由指定下列TranslucencyMode其中一個列舉值,在 上TabbedPage設定索引卷標列的半透明Xamarin.Forms.PlatformConfiguration.iOSSpecific模式:

  • Default,其會將索引標籤設定為預設的半透明模式。 此為 TabbedPage.TranslucencyMode 屬性的預設值。
  • Translucent,其會將索引標籤設定為半透明。
  • Opaque,其會將索引標籤設定為不透明。

此外,GetTranslucencyMode方法可以用來擷取套用至 TabbedPage的列舉目前值TranslucencyMode

結果是可以設定上 TabbedPage 索引標籤的半透明模式:

iOS 上半透明和不透明索引標籤的螢幕快照