gpt4 book ai didi

android - 使用 App Widget 的 TouchDelegate?

转载 作者:行者123 更新时间:2023-11-29 02:00:17 24 4
gpt4 key购买 nike

是否可以将 TouchDelegate 与 App Widget 一起使用,即与 RemoteViews 一起使用?目的是通过扩大点击区域使点击小部件上的某些按钮更容易,但不会让图像占用更多空间,因为这会影响布局。

我发现的 TouchDelegate 示例要求您使用 Activity.findViewById() 查找和使用有问题的 View ID,我认为这不会通过 AppWidgetProvider 起作用。如果不可能,是否有任何替代方案可以实现同样的目标?我也尝试过将图像放在带填充的框架布局中,但由于填充占用空间,这无济于事。谢谢。

最佳答案

Is it possible to use a TouchDelegate with an App Widget, i.e. with RemoteViews?

不,对不起。

I have also tried putting the image in a framelayout with padding, but since the padding takes up space this doesn't help.

去除填充并为 FrameLayout 的点击事件分配一个 PendingIntentView 的所有子类都有点击事件,尽管我们倾向于主要关注 ButtonImageButton。通过将您的图像放在一个容器中,该容器的大小和位置都在您希望触摸事件注册的位置,并为图像和该容器使用相同的 PendingIntent,您可以创建更大的触摸目标。

关于android - 使用 App Widget 的 TouchDelegate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13018743/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com