禁用默认的动画,从纵向到横向纵向、横向、动画

2023-09-12 08:45:31 作者:  忧伤并没有好一些、

我有,可以在横向或纵向运行几个'正常'活动的应用程序。它们的设计,大多用在人像。

I have an app with several 'normal' activities which can run on either landscape or portrait. They are designed for and mostly used on portrait.

该应用程序有一个使用了摄像头,并锁定在景观一个单一的活动。我在模拟这个活动是在纵向旋转图像和文字90度,所以它看起来像活动的其余部分。

This app has one single activity which uses the camera and is locked on landscape. I 'simulate' this activity is on portrait by rotating images and texts 90 degree, so it looks like the rest of activities.

在一些设备,如三星Galaxy Tab 7和Galaxy S3,旋转动画从正常的画像活动时需相机横向活动和背部显示。这是迷惑用户,因为景观的活动模拟正对肖像。

On some device, such as Samsung Galaxy Tab 7 and Galaxy S3, a rotation animation is shown when going from a normal portrait activity to camera landscape activity and back. This is confusing for user because landscape activity simulates being on portrait.

有没有办法来消除这种旋转动画?理想情况下,我想改变默认的纵向肖像动画,只是删除旋转动画就足够了。

Is there a way to remove this rotation animation? Ideally I'd like to change to default portrait to portrait animation, but just removing rotation animation would be enough.

我试过

overridePendingTransition(0, 0);

没有成功的方法的其他变化。

an other variations of that method without success.

[加]

继@igalarzab建议,@Georg和@Joe,我已经做到了这一点(仍然没有运气):

Following suggestions by @igalarzab, @Georg and @Joe, I've done this (still with no luck):

新增安卓configChanges =方向|屏幕尺寸的体现 新增onConfigurationChanged 创建一个虚拟的动画而什么也不做,并添加overridePendingTransition(R.anim.nothing,R.anim.nothing);

我有以下结果:

onConfigurationChanged旋转相同的活动,只有当所谓的(对人像活动A - >景观活性A)。但它不是从一个活动倾情上会时呼吁 - >景观b活动 这prevented旋转时,正在重新启动,但它并不会被删除旋转动画(银河S3,Galaxy Nexus的,Galaxy Tab的7.0和Galaxy Tab的10.1测试)活动 overridePendingTransition(R.anim.nothing,R.anim.nothing);除去正常的转换(纵向状态>纵向和landscape->景观),但它并不会被删除旋转动画(纵向状态>景观,反之亦然)。

[视频]

我已经上传了视频,显示动画我想禁用。出现这种情况,从相机的活动(锁定为横向)与其他活动同时举行电话纵向变化时:

I've uploaded a video that shows animation I want to disable. This happens when changing from camera activity (locked to landscape) to other activity while holding phone on portrait:

http://youtu.be/T79Q1P_5_Ck

推荐答案

暂时没有办法控制的旋转动画。这是后您的应用程序之外完成的,深的窗口管理器那里获取当前屏幕的截图,重新调整并重建它背后的UI,然后运行一个内置的动画,从原来的截图过渡到新的重建UI。有没有办法来改变这种行为,当屏幕旋转的变化。

Sorry there is no way to control the rotation animation. This is done way outside of your app, deep in the window manager where it takes a screenshot of the current screen, resizes and rebuilds the UI behind it, and then runs a built-in animation to transition from the original screenshot to the new rebuilt UI. There is no way to modify this behavior when the screen rotation changes.

 
精彩推荐
图片推荐