[英]How to add an activity to a widget
我创建了一个小窗口小部件应用程序。 昨天,我决定为该程序添加更多功能,因此我需要进行一次活动,因为该小部件看起来不错,但是我想在我的应用中为用户提供更多信息(列表视图,我所需要的按钮)。 因此,在/ layout文件夹中,我为活动的图形设计创建了一个“ config.xml”。 它只有一个textview,不需要编码。
然后,我创建了MainActivity.java,看起来很简单:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.config);
TextView txt = (TextView) findViewById(R.id.TextView01);
txt.setText("Something");
}
}
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bfarago.hellowidget"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<receiver android:name=".HelloWidget" android:label="@string/app_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/hello_widget_provider" />
</receiver>
<service android:enabled="true" android:name=".UpdateService" />
<activity android:name=".MainActivity"
android:label="@string/hello">
<intent_filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent_filter>
</activity>
</application>
问题是,当我启动该应用程序时,在其他应用程序中看不到它的图标。 我想念什么?
AndroidManifest.xml指定应在应用程序网格中显示默认的“ Droid”图标-默认名称(来自res / values / strings.xml )为“ User Application ”。 有吗
“启动应用程序”是指小部件还是活动? 当然,活动通常会显示并隐藏其他任何图标或应用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.