OnTouch 定位平板电脑与手机
我制作了一个专为平板电脑设计的粒子系统..无论如何,粒子都会跟随手指运动等..我实现了陀螺仪,因此当您向任何方向倾斜平板电脑时..所有粒子都会落向该方向。在清单中,我将其锁定为横向视图。
然后我将其加载到三星 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有些设备具有自然的纵向方向,有些设备具有自然的横向方向。这将影响设备的默认传感器坐标系。请查看 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