-2

I'm creating an Android Cardboard app from scratch. The CardboardView is rendered in the wrong size. This happens both on the emulator, which emulates a Galaxy Nexus Kitkat, and on a real device, a Galaxy K Zoom.

In the LogCat, I get the following message (for the emulator):

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

In the layout, I'm using:

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

I also have a res\layout\dimens.xml that has the same contents as the res\layout\dimens.xml in the Treasure Hunt sample app.

I've found that the application takes the screen size from the device, and that some devices report their screen size wrongly.
However, the "Treasure Hunt" demo app works correctly on both the emulated and the real device.

Neither of the devices is rooted.

The problem is also mentioned on here and here, but not solved on either of these sites. I also get some links from a site named quabr.com, but if they had the answer once it is no longer there.

The problem as it appears in the emulator:

CardboardView having the wrong size

1 Answers1

0

It turned out that in the XML for my CardboardView there was the following attribute:

android:layout_marginTop="172dp"

It was probably put there by Android Studio for some reason, as I did not modify the CardboardView from the "Design" interface (in fact, Android Studio wouldn't let me).

Removing this attribute solved the problem, both on the emulator and on the real device. The error message no longer occurs in the LogCat.