如何突出显示应用程序小部件中的点击?

发布于 2024-08-30 23:54:35 字数 515 浏览 11 评论 0原文

我有一个运行良好的应用程序小部件。但是,我无法突出显示对链接项目的点击。例如,我在“音乐”和“电源控制”等标准应用程序小部件中看到过它。此外,我还一直在研究音乐应用程序小部件的源代码 album_appwidget.xml。我唯一能想到的是第 23-35 行定义的 LinearLayout,其中指出
android:clickable="true"
不幸的是,这对我不起作用。那么有人知道如何突出显示应用程序小部件上的点击吗?我尝试过 LinearLayout、TextView 和 Button。它们都没有显示边框作为亮点。

提前致谢, 斯特夫

I have an app widget which runs neatly. However, I am unable to highlight a click on a linked item. I've seen it in the standard app widgets like 'Music' and 'Power Control', for instance. Moreover, I've also been studying the Music app widget's source at album_appwidget.xml. The only thing I could think of is the LinearLayout defined at lines 23-35 which states
android:clickable="true"
Unfortunately, this does not work for me. So does anyone have a hint on how to highlight a click on an app widget? I've tried the LinearLayout, TextView and Button. None of them displayed a border as a highlight.

Thanks in advance,
Steff

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

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

发布评论

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

评论(1

当爱已成负担 2024-09-06 23:54:35

您需要为这些状态(例如聚焦状态、按下状态等)创建图像(例如在按钮中)并在背景中定义它们。
尝试查看自定义按钮,其中解释了如何完成与您的需求类似的任务。
http://www.gersic.com/blog.php?id=56
如果你想查看更多并添加更多状态,如果你查看按钮的 android 源代码,你可能会得到更好的主意,其中按钮和每个其他小部件的每个状态都有图像。

you need to create images for those states like focussed state, pressed etc like in a button and define them in your background.
Try looking at the custom buttons where its explained how to accomplish the task thats similar to your needs.
http://www.gersic.com/blog.php?id=56.
if you want to look more and add more states you may ge better idea if you look at the android source code for buttons where they have images for each state of the button and every other widget.

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