三星手指悬停API

编程入门 行业动态 更新时间:2024-10-11 05:23:06
本文介绍了三星手指悬停API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

三星在悬浮API方面做得很棒,我很想将其包含在我的应用程序中.问题在于 SPen SDK 中包含的悬停API仅适用于SPen和不像三星Galaxy S4上最新的应用程序那样具有手指检测功能.

Samsung has done something great with the hovering API, and I'm interested in including it in my app. The problem is that the hovering API included in the SPen SDK only work with the SPen and not with the finger detection like the latest apps do on the Samsung Galaxy S4.

有人可以给我提供正确的SDK甚至示例项目的链接吗?

Can anyone provide me with a link to the right SDK or even a sample project?

Nifhel评论了此链接: Galaxy S4上的浮动触摸( 需要API 12 ,并创建一个从TextView继承的新类)

Nifhel commented, fallow this link: Floating Touch on Galaxy S4 (requires API 12 and to create a new class that inherit from TextView for instance)

可接受的答案是一个更好的解决方案,并且效果很好(需要API 14 ,但更易于使用).

The accepted answer is a better solution and works perfectly well (requires API 14 but easier to use).

推荐答案

我已经尝试了Nifhel推荐的链接中描述的方法. 唯一要做的就是在清单中为您的Activity添加一个新的Intent过滤器,而无需覆盖"dispatchGenericMotionEvent":

I've tried out the method described on the link recommended by Nifhel. The only thing you have to do is adding a new intent filter for your Activity in the manifest, no need to override "dispatchGenericMotionEvent":

<intent-filter> <action android:name="com.sec.android.airview.HOVER" /> </intent-filter>

之后,您必须向视图添加onHoverListener,它将正常工作. 例如在我的ListAdapter中:

After that you have to add an onHoverListener to you View and it will work fine. For example in my ListAdapter:

convertView.setOnHoverListener(new OnHoverListener() { @Override public boolean onHover(View v, MotionEvent event) { Log.d("ListAdapter", "Hover: " + item); return false; } });

更多推荐

三星手指悬停API

本文发布于:2023-08-06 11:22:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1311947.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:手指   API

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!