由于< data android:scheme ="http",应用未在启动器中列出/>在AndroidManifest.xml中 [英] App not listed in launcher due to <data android:scheme="http" /> in AndroidManifest.xml
问题描述
当我在AndroidManifest.xml中添加<data android:scheme="http" />
时,它导致我的应用不再在启动器中列出.为什么?
When I add <data android:scheme="http" />
in AndroidManifest.xml, it causes my app not to be listed in the launcher anymore. Why?
AndroidManifest.xml
不带<data android:scheme="http" />
:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ebookfrenzy.mywebview" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyWebViewActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
AndroidManifest.xml
和<data android:scheme="http" />
:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ebookfrenzy.mywebview" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyWebViewActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="http" />
</intent-filter>
</activity>
</application>
</manifest>
推荐答案
由于意图过滤器的匹配/解析过程,当Android在启动器中显示应用程序"时,它将使用匹配机制显示列表,并且当您添加您的应用不匹配,因为系统在显示启动器时不会带任何数据.
Due to the intent-filter matching/resolution process, when Android "shows the applications" in the launcher, it shows the list using matching mechanism, and when you add you app doesn't match, because the system doesn't bring any data when it displays the launcher.
解决方案是创建另一个intent过滤器,例如:
The solution is create another intent-filter, for example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ebookfrenzy.mywebview" >
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MyWebViewActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
</intent-filter>
</activity>
</application>
</manifest>
这篇关于由于< data android:scheme ="http",应用未在启动器中列出/>在AndroidManifest.xml中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!