OnTouch 定位平板电脑与手机

发布于 2024-12-07 10:42:36 字数 507 浏览 2 评论 0原文

我制作了一个专为平板电脑设计的粒子系统..无论如何,粒子都会跟随手指运动等..我实现了陀螺仪,因此当您向任何方向倾斜平板电脑时..所有粒子都会落向该方向。在清单中,我将其锁定为横向视图。

然后我将其加载到三星 Intercept 上。当我移动屏幕时,根本没有任何事情朝着正确的方向发展。所以我为解决这种情况所做的就是

if (width<800)  // My tablet width is obviously 800 phone is much less 
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
else
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

解决我的问题。但我不确定这是否适用于所有手机?我的三星拦截仅用于开发,在我看来它是一个 POS。是手机的问题还是这就是它的工作原理?

I made a particle system that was designed for a tablet.. particles follow finger movement etc. anyways.. I implemented the gyroscope so when you tilt the tablet whatever direction.. all the particles fall to that direction. In the manifest I locked it down to landscape view.

So then I loaded it up on a Samsung Intercept. When I moved that screen around nothing was going in the correct direction at all.. So what I did to fix the situation is

if (width<800)  // My tablet width is obviously 800 phone is much less 
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
else
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

this fixes my problem.. but I'm unsure if this is for all phones? My samsung intercept is only for development and it's a POS IMO. Is it the phone or is this just how it works..

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

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

发布评论

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

评论(1

盛夏尉蓝 2024-12-14 10:42:36

有些设备具有自然的纵向方向,有些设备具有自然的横向方向。这将影响设备的默认传感器坐标系。请查看 Android 开发者博客中的这篇文章,了解更多详细信息和解决方案:http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html

Some devices have a natural orientation of portrait and some have a natural orientation of landscape. This will affect the default sensor coordinate system for the device. Take a look at this post from the Android Developers blog for more details and solutions: http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html

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