- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
是否可以将 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
的点击事件分配一个 PendingIntent
。 View
的所有子类都有点击事件,尽管我们倾向于主要关注 Button
和 ImageButton
。通过将您的图像放在一个容器中,该容器的大小和位置都在您希望触摸事件注册的位置,并为图像和该容器使用相同的 PendingIntent
,您可以创建更大的触摸目标。
关于android - 使用 App Widget 的 TouchDelegate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13018743/
我有两个 ImageButtons,每个都在一个 RelativeLayout 中,而这两个 RelativeLayouts 在另一个 RelativeLayout 中,我想为每个 ImageButt
是否可以将 TouchDelegate 与 App Widget 一起使用,即与 RemoteViews 一起使用?目的是通过扩大点击区域使点击小部件上的某些按钮更容易,但不会让图像占用更多空间,因为
我的理解是,当您的 View 太小而无法轻松触摸时,您应该使用 TouchDelegate 来增加该 View 的可点击区域。 但是,在 Google 上搜索用法示例会发现很多人提出问题,但答案很少。
我是一名优秀的程序员,十分优秀!