繁体   English   中英

运行项目时,我的应用程序未在模拟器上显示

[英]My app doesn't show on emulator, when I run the project

当我尝试运行该项目时,它已成功安装在模拟器上,但模拟器未在其应用程序菜单中显示我的应用程序启动器图标。 但是它在设置>应用程序>管理应用程序>所有应用程序中显示了已安装应用程序中的我的应用程序,这意味着已安装了一个应用程序。 但它没有运行。

表现:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thenewboston.travis"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".Splash"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.thenewboston.travis.SPLASH" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name=".Main"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.thenewboston.travis.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Menu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="com.thenewboston.travis.MENU" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    </application>

     </manifest>

确保您的启动活动在清单中正确声明了其意图过滤器,以在启动器中显示。

假设您希望“ Splash”成为您的主要活动,请将其声明更改为此(特别是intent-filter操作)

 <activity
            android:name=".Splash"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
 </activity>

您的意图过滤器动作不是android默认值(以及启动程序通常查找的内容)的一部分。 只有设计为寻找动作“ com.thenewboston.travis.SPLASH”的启动器才会看到您的活动

 <activity
    android:name=".Splash"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="com.thenewboston.travis.SPLASH" /> //try "android.intent.action.MAIN" here//
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM