アプリウィジェットがICSアプリドロワーに表示されないことを経験した人はいますか?
もともと私はこのアプリをフローズンヨーグルト以下で始めました。これはアプリウィジェットをうまくサポートしています。ジンジャーブレッドとハニカムが登場しましたが、これらも機能します。
「ウィジェットプレビュー」アプリを開くと、エミュレータのリストにウィジェットが表示されますが、ドロワーを開くだけでは、他のウィジェットと一緒にリストされません。Honeycombには表示されます。私はGalaxyNexusでもそれを見ていません(そして他の人も見ていません)。
最初のインストール後に一部の人の問題が解決するのを見て、再起動してみました。また、アプリアクティビティがあるため、action.MAIN / category.LAUNCHERインテントフィルターを使用したメインアクティビティがあります。これは、ウィジェットのみのタイプのプロジェクトではありません。
以下にいくつかのスニペットを投稿します。さらに必要な場合はお知らせください。私のminSdkVersionは7、targetSdkVersionは15で、プロジェクトのプロパティでもターゲットが4.0.3でチェックされています。installLocation属性はautoに設定されています。
AndroidManifest.xml:
<receiver android:name=".AppWidget" android:label="@string/one_cell_widget_label">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.frankcalise.h2droid.FORCE_WIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/one_cell_widget_settings" />
</receiver>
one_cell_widget_settings.xml:
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/one_cell_widget"
android:minWidth="@dimen/one_cell_widget"
android:maxHeight="@dimen/one_cell_widget"
android:updatePeriodMillis="0" >
</appwidget-provider>
one_cell_widget.xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget_background"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/widget_margin"
android:background="@drawable/widget_background">
<TextView
android:id="@+id/widget_title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textColor="@android:color/black" />
<TextView
android:id="@+id/widget_amount_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/default_widget_amount"
android:textSize="12sp"
android:textColor="@color/amount_color" />
<TextView
android:id="@+id/widget_percent_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/default_widget_percent" />
</LinearLayout>
そして明らかに私はAppWidget.javaにクラスを実装しました
public class AppWidget extends AppWidgetProvider
アップデート:
今日初めに見つけた重要なlogcatメッセージは、問題の解決に役立ちました。
06-01 14:41:31.606: E/AppsCustomizePagedView(199): Widget ComponentInfo{com.frankcalise.h2droid/com.frankcalise.h2droid.AppWidget} has invalid dimensions (108, 0)