【问题标题】:Basic Android app no icon on installation基本的 Android 应用程序在安装时没有图标
【发布时间】:2014-07-08 01:19:07
【问题描述】:

我是 Android 新手,我正在尝试将最基本的应用程序安装到我的手机上以开始使用。

我按照http://developer.android.com/training/basics/firstapp/index.html 的步骤操作,安装后我的应用程序图标没有出现在手机应用程序中。它出现在“设置”>“应用程序”>“管理应用程序”中,但不在我的应用程序列表中。我使用的是三星 Galaxy S2 i9100。

这是我的清单。这是由 Eclipse 自动生成的。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.testapp"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    </application>

</manifest>

【问题讨论】:

  • 由于您没有将您的应用程序设置为启动器应用程序,因此您的应用程序图标不会显示在 UI 上。清单文件中也没有注册任何活动。

标签: android xml icons


【解决方案1】:

清单太短。 您的应用程序未添加到已启动的应用程序列表中。 您必须通过在 Manifest 中指定以下描述来将您的应用程序添加到列表中。

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.YOUR_HOME_ACTIVITY"
        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>

就是这样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-29
    • 2012-02-06
    相关资源
    最近更新 更多