是否可以制作一个包含 SeekBar 的主屏幕小部件?

发布于 2024-12-28 18:20:07 字数 493 浏览 1 评论 0 原文

对于 Android 来说有点陌生。我正在尝试创建一个主屏幕小部件,让您使用 SeekBar 视图更改铃声或音乐音量。

我正在阅读 http://developer.android.com/guide/topics/appwidgets/index.html,并惊讶地发现了一个部分, “创建应用程序小部件布局”,表示只有某些类可以由 RemoteViews 对象处理,因此只有这些类可以在主屏幕小部件中使用。支持 ProgressBar 类,但文档明确表示不支持后代类。

由于我试图在我的小部件中创建一个 SeekBar(它是 ProgressBar 的后代),因此通过 RemoteViews 这不可能吗?如果是这样,是否有另一种方法来创建不依赖 RemoteViews 的小部件?预先感谢您的任何帮助。

A bit new to Android. I am trying to create a home-screen widget that lets you change ringtone or music volume, using the SeekBar View.

I was reading on widgets in http://developer.android.com/guide/topics/appwidgets/index.html, and was surprised to come across a section, "Creating the App Widget Layout," that says only certain classes can be handled by a RemoteViews object, and thus only these can be used in a home-screen widget. The ProgressBar class is supported, but the documentation explicitly says descendant classes are not supported.

Since I am trying to create a SeekBar in my widget, which is a descendant of ProgressBar, is this impossible via RemoteViews? If so, is there another method to create widgets which does not rely on RemoteViews? Thanks in advance for any help.

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

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

发布评论

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

评论(1

若言繁花未落 2025-01-04 18:20:07

由于我试图在我的小部件中创建一个 SeekBar(它是 ProgressBar 的后代),因此通过 RemoteViews 不可能吗?

正确的。

如果是这样,是否有另一种方法来创建不依赖 RemoteViews 的小部件?

不。不过,您可以编写自己的主屏幕应用程序,并且可以在主屏幕上使用您想要的任何内容,因为它是您自己的应用程序。

Since I am trying to create a SeekBar in my widget, which is a descendant of ProgressBar, is this impossible via RemoteViews?

Correct.

If so, is there another method to create widgets which does not rely on RemoteViews?

No. You can write your own home screen app, though, and there you can use whatever you want on the home screen, since it is your own app.

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