Zum Hauptinhalt springen
Zurück zu Plugins
@capgo/capacitor-navigation-bar
Tutorial
@capgo/capacitor-navigation-bar

Navigation Bar

Benutzen Sie Android-Navigation-Leiste-Farbe und -Sichtbarkeit für immersive Benutzeroberflächen-Erfahrungen

Anleitung

Tutorial zur Navigation-Leiste

Mit @capgo/capacitor-navigation-leiste

Capacitor-Leiste-Plugin für die Anpassung der Android-Navigation-Leiste.

Installieren

bun add @capgo/capacitor-navigation-bar
bunx cap sync

Was diese Erweiterung offenlegt

  • setNavigationBarColor - Die Farbe der Navigationsleiste und das Design der Schaltfläche setzen.
  • getNavigationBarColor - Die aktuelle Farbe der Navigationsleiste und das Design der Schaltfläche abrufen.

Beispiel für die Verwendung

setNavigationBarColor

Die Farbe der Navigationsleiste und das Design der Schaltfläche setzen.

import { NavigationBar } from '@capgo/capacitor-navigation-bar';

// Set to white with dark buttons
await NavigationBar.setNavigationBarColor({
  color: NavigationBarColor.WHITE,
  darkButtons: true
});

// Set to custom color
await NavigationBar.setNavigationBarColor({
  color: '#FF5733',
  darkButtons: false
});

// Set a custom divider color on Android 9+
await NavigationBar.setNavigationBarColor({
  color: NavigationBarColor.WHITE,
  darkButtons: true,
  dividerColor: '#D9D9D9'
});

getNavigationBarColor

Die aktuelle Farbe der Navigationsleiste und das Design der Schaltfläche abrufen.

import { NavigationBar } from '@capgo/capacitor-navigation-bar';

const { color, darkButtons } = await NavigationBar.getNavigationBarColor();
console.log('Current color:', color);
console.log('Using dark buttons:', darkButtons);

Vollständige Referenz

Weitermachen von Using @capgo/capacitor-Navigationsleiste

If Sie native Medien und Schnittstellenverhalten planen, verbinden Sie es mit Mit @capgo/capacitor-navigation-bar native Medien und Schnittstellenverhalten zu planen um es mit @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-navigation-bar zu verbinden Umsetzungsdetails in @capgo/capacitor-navigation-bar for the implementation detail in @capgo/capacitor-navigation-bar, Umsetzungsdetails in Getting Started Mit @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-live-activities native Fähigkeiten zu nutzen Um sich mit der Umsetzung von @capgo/capacitor-live-activities zu beschäftigen @capgo/capacitor-live-activities Umsetzungsdetails in @capgo/capacitor-live-activities Mit @capgo/capacitor-video-player Um sich mit der Umsetzung von @capgo/capacitor-video-player zu beschäftigen für die native Fähigkeit in Using @capgo/capacitor-video-player.