我已按照本指南(https://developers.google.com/web/android/trusted-web-activity/quick-start)来构建TWA应用程序,但是我需要隐藏android软导航栏(而不是URL栏)。
我找到了这个(https://developer.android.com/training/system-ui/navigation),但不知道在哪里放置onResume()方法。
我之前在Android Studio中什么都没做,对此我是完全陌生的。非常感谢您的帮助。
谢谢
您指的是在Android上称为Immersive Mode。 Bubblewrap尚不支持该功能,但是正在this issue中跟踪该功能请求。
同时,可以手动更新Bubblewrap创建的项目以使用全屏/沉浸式模式:
app/build.gradle
以使用最新版本的android-browser-helper版本。文件底部的dependencies
部分应如下所示:dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.androidbrowserhelper:androidbrowserhelper:1.3.0'
}
注意,androidbrowserhelper的最低版本应为1.3.0
。
app/src/main/AndroidManifest.xml
并添加一个新的meta-data
标签,并将android:name
属性设置为android.support.customtabs.trusted.DISPLAY_MODE
,并将android:value
属性设置为immersive
,以便在activity
标签内使用沉浸模式:<activity android:name="com.google.androidbrowserhelper.trusted.LauncherActivity"
android:label="@string/launcherName">
...
<meta-data android:name="android.support.customtabs.trusted.FALLBACK_STRATEGY"
android:value="@string/fallbackType" />
<meta-data android:name="android.support.customtabs.trusted.DISPLAY_MODE"
android:value="immersive"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
...
</activity>
现在,当运行bubblewrap build
时,应用程序将使用额外的元标记并以全屏/沉浸式模式启动。