Android:使用 AppWidget 及其允许的操作

发布于 2024-12-05 08:41:12 字数 290 浏览 1 评论 0原文

我来这里是为了解决我对AppWidget的疑问。 目前我正在尝试构建一个可视化时间表的AppWidget; 我构建了一个布局,其中包含一周中的几天的列,其中包含: 一个 FrameLayout,其中包含一个 LinearLayout(用于背景)和一个要在其中放置用户约会的相对布局。 关于约会,我想构建 TextView,它在相对布局中的尺寸、颜色和位置可以不同......

有谁知道如何做到这一点吗?

我发现 RemoteView 的可用操作非常有限,但同时我发现了一些具有此功能的 AppWidget。

非常感谢。

I'm here to ask you an help to my doubts on AppWidget.
At the moment I'm trying to build an AppWidget that visualizes a timetable;
I have build a layout that contains columns for days of week made of:
a FrameLayout that contains a LinearLayout(for a background) and a RelativeLayout in which I want to put user appointments.
About appointments I want to build TextView that can be different in dimension, color, and position in the RelativeLayout...

is there anyone who knows how to this?

I have seen that RemoteViews are very limited in available actions but at the same time I have found some AppWidgets those do this feature..

Thanks a lot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫弦 2024-12-12 08:41:12

您可以在一定程度上操作小部件(例如,在更新小部件时设置完全不同的小部件布局),但是,RemoteViews 是有一定限制的。由于你的问题的第一部分很模糊,我只能在这里给出这个答案。但是您可以使用哪些View以及在RemoteView上可以进行哪些操作都有很好的文档记录。

您可能已经看到并且很常见的是看起来像小部件但实际上是启动器功能的东西。例如 HTC sense 小部件。对于菜单、列表视图和其他一些东西中的一个小部件条目,它们可以具有不同的大小。那是因为他们以一种未记录的方式使用感知启动器,外部开发人员无法使用。通常,您可以通过使用不同的启动器(例如 android stock 启动器)放置有问题的小部件来确定该小部件是否是真正的小部件。这些“特殊”小部件无法完成此操作,它们会显示错误。

You can manipulate widgets to a certain extend (e.g. setting a completely different widget layout when updating it), but yes, RemoteViews are somewhat limited. Since the first part of your question is vague, I can only give this answer here. But which Views you can use and what operations are available on RemoteViews is pretty well documented.

What you might have seen, and is quite common, is something that looks like a widget but is in reality a launcher feature. For example the HTC sense widgets. These can have different sizes for one single widget entry from the menu, listviews and some other things. Thats because they are using the sense launcher in an undocumentated way that is not useable by external devs. Often you can find out if the widget in question is a real widget by placing it using a different launcher (e.g. the android stock launcher). This can't be done with these 'special' widgets, they will show an error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文