English 中文(简体)
Anders: Haptic submissions: onClick() activity vs hapticFeedback 这一观点
原标题:Android: Haptic feedback: onClick() event vs hapticFeedbackEnabled in the view
  • 时间:2010-05-13 20:23:39
  •  标签:
  • java
  • android

If you want a button to provide haptic feedback (ie, the phone vibrates very briefly so you can feel that you really pushed the button), what s the standard way to do that? It seems you can either explicitly set an onClick() event and call the vibrate() function, giving a number of milliseconds to vibrate, or you can set hapticFeedbackEnabled in the view.

文件似乎表明,后者只是用于长期压力或虚拟筛选钥匙:

如果是这样的话,那么我要么把我ton子变成一个虚拟的屏幕上的关键,要么手工地在Click()活动上确定。

你们建议什么?

而且,如果我想要在用户触角时立即发生振动,而不是当他们inger子“释放”时,那么,什么是实现这一目标的最佳途径?

相关问题: 如何使关于纽芬兰语的 ha反馈

问题回答

Android Cookbook - Chapter Haptic Feedback

摘要:需要几个步骤:

  • enable vibration in manifest
  • enable haptic feedback for the button/view
  • register an onTouch Listener for your button
  • call performHapticFeedback() on Touch down

You can have both a onTouchLister for the haptic feedback and a onClickHandler for your action, just make sure the the onTouchHandler returns false, otherwise the event is marked as consumed and not given to the onClickHandler.

我在计算器中使用正值,但这只是因为系统在我撰写时没有习惯反馈办法。 出于若干原因,我不建议采取这种做法。 尤其是,每部电话都有不同的特征(男性、振动的摩托车、摩托车等),因此每部电话上的“女餐”权在另一部电话上是正确的。

然而,假设个人电话制造商在其特定产品上至少做了些什么“调整”,那是公平的,因此,所建的 ha素反馈更有机会全面感受到。

此外,如上所述,如果你执行自己的热情反馈,你就不得不在你的喜好中为之做自己的事。 更糟的是,让用户在全系统的基础上确定。

时间允许(hah!) 我计划从使用振奋剂转向使用该系统的内在 ha反馈。

I think that calling vibrate() manually is not a good idea. It would mean someone who doesn t want haptic feedback will have his phone vibrating. Plus I don t know how it reacts on non-vibrating products. setHapticFeedbackEnabled is definitely the good way to do it; the method was created for this very specific purpopse.

迄今为止,我的唯一解决办法是呼吁在登克罗赖斯特州安装<>performHapticFeedback。 这种做法是可行的,但似乎是一种黑板。

Immersion开发了一个Android Haptic Feedback SDK,将现实带给和roid。 等待运动会:





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签