如何将小工具添加到从我的应用程序在Android主屏幕? [英] How to add a widget to the Android home screen from my app?

查看:301
本文介绍了如何将小工具添加到从我的应用程序在Android主屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写这应该能够部件(只是文本框)添加到用户的手机的主屏幕,当用户指示我的应用程序这样做的应用程序。我该怎么做这样的事?

I'm writing an application which should be able to add widgets (just text boxes) to the home screen of the user's phone when the user instructs my app to do so. How can I do such a thing?

我知道,我可以添加一个应用程序窗口小部件,但如何增加更多的?

I know that I can add an app widget but how about adding more?

推荐答案

这是不可能的,从一个应用程序放置一个小部件在主屏幕。只有主屏幕可以添加应用程序,窗口小部件的主屏幕。

It is not possible from a app to place a widget in the home screen. Only the home screen can add app widgets to the home screen.

相似的链接 LINK1 ,的链接2 ,<一个href="https://groups.google.com/forum/?fromgroups=#!topic/android-developers/IxJFum0eaQ8">link3

但你可以提供用户从widgetpicker部件挑选。

But you can offer user to pick widget from widgetpicker.

    Intent pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
    pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetID);
    startActivityForResult(pickIntent, KEY_CODE);

这篇关于如何将小工具添加到从我的应用程序在Android主屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆