CardboardView 尺寸不合适

CardboardView does not have the right size

我正在从头开始创建一个 Android Cardboard 应用程序。 CardboardView 以错误的大小呈现。这在模拟 Galaxy Nexus Kitkat 的模拟器和真实设备 Galaxy K Zoom 上都会发生。

在 LogCat 中,我收到以下消息(针对模拟器):

E/CardboardViewNativeImpl: Surface size 656x872 does not match the expected screen size 1280x720. Stereo rendering might feel off.

在布局中,我使用:

android:layout_width="fill_parent"
android:layout_height="fill_parent"

我还有一个 res\layout\dimens.xml,它的内容与 Treasure Hunt 示例应用程序中的 res\layout\dimens.xml 相同。

我发现该应用程序从设备获取屏幕尺寸,并且某些设备错误地报告了它们的屏幕尺寸。
但是,"Treasure Hunt" 演示应用程序在模拟设备和真实设备上都能正常运行。

两台设备都没有 root。

here and here 上也提到了这个问题,但在这两个网站上都没有解决。 我还从一个名为 quabr.com 的网站获得了一些链接,但如果他们有答案,一旦它不再存在。

模拟器中出现的问题:

事实证明,在我的 CardboardView 的 XML 中有以下属性:

android:layout_marginTop="172dp"

它可能是 Android Studio 出于某种原因放在那里的,因为我没有从 "Design" 界面修改 CardboardView(事实上,Android Studio 不会让我)。

删除此属性解决了模拟器和真实设备上的问题。 LogCat.

中不再出现错误消息