Dem*_*218 7 android chrome-custom-tabs
我正在寻找一种方法,正如标题所说的隐藏网址栏。
到目前为止我已经有了这个,但它没有改变任何东西。
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
builder.setShowTitle(false);
builder.enableUrlBarHiding();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));
Run Code Online (Sandbox Code Playgroud)
我曾尝试使用 webviews,但在文件上传和某些无法正常工作的 css 方面,我遇到了无穷无尽的问题。自定义选项卡在所有这些方面都运行良好,而且速度似乎更快。
根据@113408 的回答,我正在尝试实施 TWA,我已经让它工作了,将网站与应用程序和应用程序之间的链接添加到网站,但 URL 栏仍然可用。
这是清单文件,因为它是我完成的唯一编码。
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.comppanynme.twatest">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<meta-data
android:name="asset_statements"
android:resource="@string/asset_statements" />
<activity
android:name="android.support.customtabs.trusted.LauncherActivity">
<!-- Edit android:value to change the url opened by the TWA -->
<meta-data
android:name="android.support.customtabs.trusted.DEFAULT_URL"
android:value="http://192.168.8.46" />
<!-- This intent-filter adds the TWA to the Android Launcher -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!--
This intent-filter allows the TWA to handle Intents to open
airhorner.com.
-->
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
<!-- Edit android:host to handle links to the target URL-->
<data
android:scheme="http"
android:host="192.168.8.46"/>
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
这是我的资产声明
<string name="asset_statements">
[{
\"relation\": [\"delegate_permission/common.handle_all_urls\"],
\"target\": {
\"namespace\": \"web\",
\"site\": \"http://192.168.8.46"}
}]
</string>
Run Code Online (Sandbox Code Playgroud)
113*_*408 10
您可以使用Trusted Web Activity实现所需的结果
可信 Web 活动是一种使用基于自定义选项卡的协议将您的 Web 应用程序内容(例如 PWA)与您的 Android 应用程序集成的新方法。
最终 TWA 将允许您执行与 完全相同CustomChromeTabs但提供更多功能的操作。
您更具体地寻找的是删除网址栏
受信任的 Web 活动需要在 Android 应用程序和要建立的网站之间建立关联以移除 URL 栏。
注意:当隐藏 URL 栏时,请确保您通过提供您的页面,HTTPS否则您将无法隐藏,因为该页面被认为是不安全的。
| 归档时间: |
|
| 查看次数: |
10189 次 |
| 最近记录: |