我在这里有一个基本的时钟小工具,它在4.0以下的Android版本上工作得很好,你可以长按,选择小工具和它的权利。但是,当我尝试在4.0或更高版本的仿真器或实际设备上运行它时,它不会在设置>存储>应用程序中的小部件部分中显示。我曾尝试添加一个简单的活动,只是给用户指示如何安装小部件,该建议作为答案在这里给出:Android 4.0: widgets not appearing?。除非我做错了,小部件仍然不会显示在小部件抽屉中。Android 4.0+中未显示的小工具
这里是我的清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.widgetexample1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".ExampleAppWidgetProvider"
android:label="8-bit cloud widget 1">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widget1_info" />
</receiver>
</application>
</manifest>
至今还没有找到一个解决方案,帮助将不胜感激。 – 2012-08-06 18:35:37
也许这可以帮助你http://stackoverflow.com/questions/8794952/android-4-0-widgets-not-appearing 我现在有同样的问题。 – 2012-10-17 08:16:55