【发布时间】:2012-01-15 05:56:45
【问题描述】:
我在将小部件添加到我的主屏幕时遇到问题。
我创建了一个新的、完全空的页面,但没有列出几个应用小部件。我下载了许多应用程序,其中一个是我自己编写的,但它们都没有出现在要添加的小部件列表中。
什么可能的原因会导致这种情况?我在想要么是我的手机(Huawei Sonic)不支持这些特定的小部件,这对于我编写的一个非常简单的小部件来说很奇怪,要么我禁用了一些重要的东西......
有什么建议吗?
更新 根据要求,这里有一些代码,感谢到目前为止的帮助。
清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.widget"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<receiver android:name=".Widget" android:label="Countdown">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widget" />
</receiver>
</application>
这是我的 main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout01"
android:layout_height="200dp"
android:background="@drawable/background"
android:layout_width="160dp"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:textColor="@android:color/black"
android:text="17:12:34 PM"
android:textSize="8pt" />
</LinearLayout>
【问题讨论】:
-
What have you tried? 发布您的代码也很有用。