我无法弄清楚为什么在一个活动的清单中设置"sensorPortrait"属性不能使活动进入反向纵向.这就是我在清单中设置的方式
<activity
android:name=".MainActivty"
android:label="Testing"
android:screenOrientation="sensorPortrait"
android:windowSoftInputMode="stateHidden"
android:configChanges="orientation">
</activity>
Run Code Online (Sandbox Code Playgroud)
以上代码对我来说无法在Moto E(4.4.4)或Galaxy S3(4.3)上同时获得reversePortrait和肖像,但我可以确认它适用于Nexus 7(5.0.1)平板电脑,我尝试了其他几个答案,但这个似乎是最简单的,它似乎不适合我的'手机',我错过了一些与此相关的信息吗?
我尝试了以下链接,这与我的问题类似,但对此没有任何帮助
目前使用标志"sensorPortrait",它的行为就像在手机中设置"肖像"一样.
我的第一个iOS 2D游戏的代码是写的.现在,谈到资产,我感到迷茫.一个原因是由于过时的物品导致的不完美感.我需要知道图像大小,才能开始设计.游戏的设备方向仅为纵向.状态栏被隐藏(游戏).这些设备是通用的,主要的iPhone,但我当然没有异议,如果iPad的尺寸也很好.为此目的开始设计的最佳图像尺寸是多少?
如果我没有你的帮助,我会开始在1242 x 2208和401ppi创建背景(全屏)图像.然后,在Photoshop中将最终图像缩小到750 x 1334(4,7")和640 x 1136(4").我的方法是对的吗?特别是,最好从1242 x 2208开始还是1080 x 1920罚款?
我想知道为什么 Flutter 在 iOS 设备上运行时可以从纵向旋转到横向,但在我的 Android 设备上根本不旋转?
作为代码示例,您可以在下面找到“hello world”示例。同样,对于这个简单的代码示例,Flutter 开箱即用地为 iOS 设备旋转,但它不会为 Android 旋转。为什么 ??
对于添加 ListViews 或其他的更复杂的应用程序也是如此(即 iOS 很好地旋转屏幕,Android 没有)。
我发现了一个叫做OrientationBuilder( link1 ) 或MediaQuery.orientation( link2 ) 的东西。但这似乎只能提供区分设备方向的能力,然后您必须相应地在代码中采取行动。这似乎是一个可能的解决方案,但我想知道为什么我必须为 Android 设备而不是为 iOS 投资额外的工作?
我正在寻找的是 Flutter 下 Android 的“自动”旋转可能性(就像 iOS 开箱即用一样)。我怎么能做到这一点?
这是我的“hello world”示例的两个屏幕截图。(iOS 开箱即用/Android 没有):
这是 Dart 代码:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo …Run Code Online (Sandbox Code Playgroud) 我搜索高低,我不确定我出来的是处理这个问题的最佳方式(尽管它似乎是唯一的一个).
根据想要使用muliple笔尖来实现不同的iphone接口方向,我实现了相关的方法,一切似乎都运行良好.不幸的是,我必须处理UINavigationController,每个页面都必须支持纵向和横向模式,并在两种模式下重现相同的功能.这意味着如果用户在某个时刻决定从纵向切换到横向,整个应用程序应该允许他以他选择的模式在页面中来回导航.
显然,缺少的文档是如何处理这个问题.在我的视图中,我有许多带有附加showChild方法的按钮,用于执行导航.一切都适用于纵向模式(据我所知,这是默认模式).方法如下:
- (IBAction)showChild:(UITapGestureRecognizer *)sender {
UIView *view = [sender view];
PortraitViewController *nextPortraitViewcontroller = [[PortraitViewController alloc] initWithNibName:@"Portrait" bundle:nil];
[self.navigationController pushViewController:nextPortraitViewcontroller animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
但是当谈到景观模式时,我会得到喜忧参半的结果.LandscapeViewController类中的showChild:方法完全相同,它构建一个从PortraitViewController开始的视图,并将其推送到导航控制器.这一切看起来都很顺利,但是当我向后导航时,我得到的是前面的PortraitViewController,而不是景观,而且它的子视图都散布在周围,而不是我放在它们的位置.
现在的问题是:因为Apple似乎并不真正关心文档和最佳实践(假设整个机制远非理想,我可以说这来自人机交互设计和编程的背景)是什么correc - Apple这样做的方式?
landscape portrait uitabbarcontroller uinavigationcontroller ios
目前,当您将外接显示器连接到支持镜像的 Android 手机时,手机会假设外接显示器设置为横向。因此,当手机垂直(在本例中为 Galaxy S III)纵向握持时,显示屏上的视频输出是纵向的,但在两侧以黑条居中。当然,当手机水平握持时,输出会填满外接显示器。
我正在寻找的是一种强制 Galaxy S III 镜像其屏幕的方法,这样当它以纵向放置时,输出将填满外部显示器。它必须在 Android 上运行 - 我不是特别在谈论特定的应用程序,它需要在所有应用程序中一致地运行。
外部显示器将垂直安装,因此 Galaxy S III 在纵向时的输出必须完全填满外部显示器并具有正确的方向。
谁能给我任何关于从哪里开始的建议?我已经查看了 S III 的源代码,但找不到任何线索(我没有在 Android 上编写自己的驱动程序的经验)。这将适用于美国变体(特别是 Verizon,尽管视频硬件 - Adreno 225 GPU 和 SiI9234 MHL 控制器芯片 - 在所有美国变体中都是相同的)。也许在该领域更有经验的人可以对此有所了解。
我刚刚向应用程序商店发布了一款游戏,并意识到我完全忘记将其锁定为仅限肖像.我需要提交一个更新版本.在这一点上,仅仅去一般>部署信息并取消选中除Portrait之外的所有内容,然后将其作为新构建提交是否足够?或者我还需要对代码做些什么?请注意,它是一个快速的应用程序.
我正在使用陀螺仪在 iOS 上实现 360 度视频查看器,我需要为视频进行两次旋转,我使用了这个;
self.motionManager.deviceMotionUpdateInterval = 1.0/60.0;
if (self.motionManager.isDeviceMotionAvailable) {
CMDeviceMotion *deviceMotion = self.motionManager.deviceMotion;
CMAttitude *currentAttitude = deviceMotion.attitude;
//[self.motionManager startDeviceMotionUpdates];
[self.motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXArbitraryZVertical];
}
Run Code Online (Sandbox Code Playgroud)
然后我这样做:
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
CMDeviceMotion *currentDeviceMotion = self.motionManager.deviceMotion;
CMAttitude *currentAttitude = currentDeviceMotion.attitude;
float roll = currentAttitude.roll;
float pitch = currentAttitude.pitch;
float yaw = currentAttitude.yaw;
if (isLandscape)
{
_player.rotation = -yaw + currentLocation.x;
// 0 roll is phone flat, so we need to rotate -90 degrees to adjust vertical phone
if (orientation == UIDeviceOrientationLandscapeLeft) …Run Code Online (Sandbox Code Playgroud) 我试图让我的应用程序仅在纵向和反向纵向模式下工作(而不是横向)。这是我的应用程序的 SDK 详细信息
minSdkVersion 15
targetSdkVersion 23
Run Code Online (Sandbox Code Playgroud)
在 AndroidManifest.xml 文件中,我在每个活动标签中都有以下行
android:screenOrientation="sensorPortrait"
Run Code Online (Sandbox Code Playgroud)
我尝试了很多其他答案,但没有一个对我有用。请帮我解决这个问题。谢谢。
如何将相机设置为横向模式?每次我拍照时,图像都会保存为人像图像。当设备处于横向模式时,照片看起来不错,但如果我在相机胶卷中看到它,它仍然是纵向模式。这是我的拍照功能:
// take a photo
@IBAction func takePhoto(sender: AnyObject) {
self.fullScreenView.hidden = false
self.recordButton.enabled = false
self.takephoto.enabled = false
self.recordButton.hidden = true
self.takephoto.hidden = true
session.startRunning()
// customize the quality level or bitrate of the output photo
session.sessionPreset = AVCaptureSessionPresetPhoto
// add the AVCaptureVideoPreviewLayer to the view and set the view in fullscreen
fullScreenView.frame = view.bounds
videoPreviewLayer.frame = fullScreenView.bounds
fullScreenView.layer.addSublayer(videoPreviewLayer)
// add action to fullScreenView
gestureFullScreenView = UITapGestureRecognizer(target: self, action: #selector(ViewController.takePhoto(_:)))
self.fullScreenView.addGestureRecognizer(gestureFullScreenView)
// add action to myView
gestureView = UITapGestureRecognizer(target: …Run Code Online (Sandbox Code Playgroud) 注意:我帖子中的所有信息仅适用于 Samsung Galaxy S7 设备。我不知道模拟器和其他设备的行为如何。
在 onImageAvailable 中,我将每个图像连续转换为 NV21 字节数组,并将其转发到需要原始 NV21 格式的 API。
这是我初始化图像读取器并接收图像的方式:
private void openCamera() {
...
mImageReader = ImageReader.newInstance(WIDTH, HEIGHT,
ImageFormat.YUV_420_888, 1); // only 1 for best performance
mImageReader.setOnImageAvailableListener(
mOnImageAvailableListener, mBackgroundHandler);
...
}
private final ImageReader.OnImageAvailableListener mOnImageAvailableListener
= new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader reader) {
Image image = reader.acquireLatestImage();
if (image != null) {
byte[] data = convertYUV420ToNV21_ALL_PLANES(image); // this image is turned 90 deg using front cam in portrait mode
byte[] data_rotated = rotateNV21_working(data, …Run Code Online (Sandbox Code Playgroud) portrait ×10
android ×4
ios ×4
landscape ×3
swift ×3
orientation ×2
assets ×1
camera ×1
device ×1
devicemotion ×1
flutter ×1
front-camera ×1
galaxy ×1
hdmi ×1
mirroring ×1
objective-c ×1
rotation ×1
size ×1
xcode ×1
xcode6 ×1