我有一个应用程序。我为我的应用程序开发了一个小部件。这两个都是单独开发的。我想将此小部件包含到我现有的应用程序中。这样,当用户安装我的应用程序时,小部件也会自动安装。我该如何实现这一目标?提前感谢...
1 回答
I did this in one of my project. I don't have my business laptop in hand, so I have no way to show you detailed code. But I can tell you that, Android don't allow you to directly install a widget in your application. You must use Android standard way to install widget to your application. In other words, you need to invoke system widget list, just when like you long-tap on home screen a widget list is pop up. After user choose a widget from the list, your application will get the widget's handle (or id), then you can use the widget handle to embed widget view to your application's view.