@capawesome/capacitor-android-edge-to-edge-support

中文文档
8.0.8发布于 2026/04/13MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 41.3万

Capacitor plugin to support edge-to-edge display on Android.

原始使用文档
文档目录20 节
  1. Newsletter
  2. Compatibility
  3. Installation
  4. Android
  5. Configuration
  6. Examples
  7. Usage
  8. API
  9. disable()
  10. enable()
  11. getInsets()
  12. setBackgroundColor(...)
  13. setNavigationBarColor(...)
  14. setStatusBarColor(...)
  15. Interfaces
  16. FAQ
  17. What about Capacitor 8's built-in edge-to-edge support?
  18. Is this plugin compatible with Capacitor's SystemBars API?
  19. Changelog
  20. License

@capawesome/capacitor-android-edge-to-edge-support

Capacitor plugin to support edge-to-edge display on Android with advanced features like setting the background color of the status bar and navigation bar.

BeforeAfterBeforeAfter

Attention: Despite its name, this plugin doesn't enable edge-to-edge mode by default. Instead, it preserves the traditional app behavior by applying proper insets to the webview, preventing Android's edge-to-edge changes from affecting apps that haven't been designed to support it.

Newsletter

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our Capawesome Newsletter.

Compatibility

Plugin VersionCapacitor VersionStatus
8.x.x>=8.x.xActive support
7.x.x7.x.xDeprecated

Installation

You can use our AI-Assisted Setup to install the plugin. Add the Capawesome Skills to your AI tool using the following command:

npx skills add capawesome-team/skills --skill capacitor-plugins

Then use the following prompt:

 Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-android-edge-to-edge-support` plugin in my project.

If you prefer Manual Setup, install the plugin by running the following commands and follow the platform-specific instructions below:

npm install @capawesome/capacitor-android-edge-to-edge-support
npx cap sync

Android

Capacitor SystemBars Plugin

Make sure to disable the built-in insets handling of the Capacitor SystemBars plugin in your Capacitor Configuration file:

{
  "plugins": {
    "SystemBars": {
      "insetsHandling": "disable"
    }
  }
}

Please note that this plugin is part of the Capacitor core and the insets handling is always enabled by default.

Capacitor Keyboard Plugin

If you are using the Capacitor Keyboard plugin, make sure to set the resizeOnFullScreen property to false (default) in your Capacitor Configuration file:

{
  "plugins": {
    "Keyboard": {
      "resizeOnFullScreen": false
    }
  }
}

Otherwise, the web view will be resized to fit the screen, which may cause issues with this plugin, see this comment.

Configuration

PropTypeDescriptionSince
backgroundColorstringThe hexadecimal color to set as the background color of the status bar and navigation bar.7.1.0
navigationBarColorstringThe hexadecimal color to set as the background color of the navigation bar area. Only available on Android.8.0.0
statusBarColorstringThe hexadecimal color to set as the background color of the status bar area. Only available on Android.8.0.0

Examples

In capacitor.config.json:

{
  "plugins": {
    "EdgeToEdge": {
      "backgroundColor": "#ffffff",
      "navigationBarColor": "#000000",
      "statusBarColor": "#ffffff"
    }
  }
}

In capacitor.config.ts:

/// <reference types="@capawesome/capacitor-android-edge-to-edge-support" />

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  plugins: {
    EdgeToEdge: {
      backgroundColor: "#ffffff",
      navigationBarColor: "#000000",
      statusBarColor: "#ffffff",
    },
  },
};

export default config;

Usage

The plugin only needs to be installed. It applies insets to the web view to support edge-to-edge display on Android. The plugin also provides a method to set the background color of the status bar and navigation bar. It's recommended to use this method in combination with the SystemBars plugin.

import { EdgeToEdge } from '@capawesome/capacitor-android-edge-to-edge-support';
import { SystemBars, SystemBarsStyle } from '@capacitor/core';

const enable = async () => {
  await EdgeToEdge.enable();
};

const disable = async () => {
  await EdgeToEdge.disable();
};

const getInsets = async () => {
  const result = await EdgeToEdge.getInsets();
  console.log('Insets:', result);
};

const setDarkStyle = async () => {
  await SystemBars.setStyle({ style: SystemBarsStyle.Dark });
  await EdgeToEdge.setBackgroundColor({ color: '#000000' });
};

const setLightStyle = async () => {
  await SystemBars.setStyle({ style: SystemBarsStyle.Light });
  await EdgeToEdge.setBackgroundColor({ color: '#FFFFFF' });
};

API

disable()

disable() => Promise<void>

Disable the edge-to-edge mode.

Only available on Android.

Since: 7.2.0


enable()

enable() => Promise<void>

Enable the edge-to-edge mode.

Only available on Android.

Since: 7.2.0


getInsets()

getInsets() => Promise<GetInsetsResult>

Return the insets that are currently applied to the webview.

Only available on Android.

Returns: Promise<GetInsetsResult>

Since: 7.2.0


setBackgroundColor(...)

setBackgroundColor(options: SetBackgroundColorOptions) => Promise<void>

Set the background color of the status bar and navigation bar.

Only available on Android.

ParamType
optionsSetBackgroundColorOptions

Since: 7.0.0


setNavigationBarColor(...)

setNavigationBarColor(options: SetNavigationBarColorOptions) => Promise<void>

Set the background color of the navigation bar area.

Only available on Android.

ParamType
optionsSetNavigationBarColorOptions

Since: 8.0.0


setStatusBarColor(...)

setStatusBarColor(options: SetStatusBarColorOptions) => Promise<void>

Set the background color of the status bar area.

Only available on Android.

ParamType
optionsSetStatusBarColorOptions

Since: 8.0.0


Interfaces

GetInsetsResult

PropTypeDescriptionSince
bottomnumberThe bottom inset that was applied to the webview. Only available on Android.7.2.0
leftnumberThe left inset that was applied to the webview. Only available on Android.7.2.0
rightnumberThe right inset that was applied to the webview. Only available on Android.7.2.0
topnumberThe top inset that was applied to the webview. Only available on Android.7.2.0

SetBackgroundColorOptions

PropTypeDescriptionSince
colorstringThe hexadecimal color to set as the background color of the status bar and navigation bar.7.0.0

SetNavigationBarColorOptions

PropTypeDescriptionSince
colorstringThe hexadecimal color to set as the background color of the navigation bar area.8.0.0

SetStatusBarColorOptions

PropTypeDescriptionSince
colorstringThe hexadecimal color to set as the background color of the status bar area.8.0.0

FAQ

What about Capacitor 8's built-in edge-to-edge support?

Capacitor 8 introduced native edge-to-edge functionality through the internal SystemBars plugin. While this covers many common scenarios, this plugin addresses additional edge cases that aren't yet fully resolved in the Capacitor core implementation. We plan to deprecate this plugin once all edge cases are properly handled in Capacitor core.

Is this plugin compatible with Capacitor's SystemBars API?

Yes, this plugin is partially compatible with the new SystemBars API introduced in Capacitor 8. For example, methods like setStyle() from the SystemBars API are supported and can be used alongside this plugin without conflicts.

Changelog

See CHANGELOG.md.

License

See LICENSE.

版本与发布记录

@capawesome/capacitor-android-edge-to-edge-support 共发布 18 个版本,首次发布于 2025/02/06;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
8.0.8latest2026/04/136 个月前
8.0.72026/04/136 个月前
8.0.62026/02/198 个月前
8.0.52026/02/049 个月前
8.0.42026/02/039 个月前
8.0.32026/01/239 个月前

其他发布通道:dev → 7.0.0-dev.1765885034。

关于 @capawesome/capacitor-android-edge-to-edge-support 的常见问题

@capawesome/capacitor-android-edge-to-edge-support 是什么?

Capacitor plugin to support edge-to-edge display on Android.

如何安装 @capawesome/capacitor-android-edge-to-edge-support?

在项目目录运行 npm install @capawesome/capacitor-android-edge-to-edge-support,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(>=8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@capawesome/capacitor-android-edge-to-edge-support 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@capawesome/capacitor-android-edge-to-edge-support 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@capawesome/capacitor-android-edge-to-edge-support 可以商用吗?

@capawesome/capacitor-android-edge-to-edge-support 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@capawesome/capacitor-android-edge-to-edge-support 的下载量有多少?

根据 npm 官方下载统计,@capawesome/capacitor-android-edge-to-edge-support 在 2026/10/09 – 2026/11/07 这 30 天内被下载 412,871 次,日均约 13,762 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@capawesome/capacitor-android-edge-to-edge-support 还在维护吗?

最新版本 8.0.8 发布于 2026/04/13(6 个月前);至今共发布 18 个版本,其中过去 12 个月发布了 10 个;首次发布于 2025/02/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。