For some reasons, we had the terrible idea to have an application with a fixed landscape orientation and one "screen" is in portrait. Since we are using libgdx, we only rotate all the drawing part for that screen and we are also able to rotate the Ads:
出于某些原因,我们有一个可怕的想法,即具有固定横向方向的应用程序,并且一个“屏幕”是纵向的。由于我们使用的是libgdx,我们只旋转该屏幕的所有绘图部分,我们也可以旋转广告:
adView.setRotation(-90.0f);
adView.setTranslationX(adView.getWidth() / 2 - adView.getHeight() / 2);
We are now integrating the Google Play Game Services but the popups are not displayed in the correct direction (ie. they are displayed in landscape). And I don't know how to rotate them.
我们现在正在整合Google Play游戏服务,但弹出窗口没有以正确的方向显示(即它们以横向显示)。我不知道如何旋转它们。
mGamesClient = new GamesClient.Builder(getContext(), this, this)
.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL)
.setScopes(mScopes)
.create();
I know there is a setView
method available, but I don't know how to create a view that the GamesClient could use.
我知道有一个setView方法可用,但我不知道如何创建GamesClient可以使用的视图。
1 个解决方案
#1
2
Although not "ideal" you could probably change the orientation at run time when you go to the portrait screen and then switch back to landscape upon leaving that screen.
虽然不是“理想”,但是当您转到纵向屏幕然后在离开该屏幕时切换回横向时,您可能会在运行时更改方向。
For that you'd use Activity#setRequestedOrientation(int) in your MainActivity (or whatever you called your AndroidApplication
subclass). You'd likely want to define an interface for invoking this if you are following the normal LibGDX setup.
为此,您可以在MainActivity中使用Activity#setRequestedOrientation(int)(或者您称为AndroidApplication子类的任何内容)。如果您遵循正常的LibGDX设置,您可能希望定义一个用于调用此接口的接口。
You should get a resize event in which you can get set up for the new orientation (you'd no longer rotate your rendering or ad).
您应该获得一个调整大小事件,您可以在其中设置新方向(您不再旋转渲染或广告)。
Alternatively, you could redesign this one screen to be landscape like the rest of the app.
或者,您可以重新设计这个屏幕,使其像应用程序的其余部分一样风景。
#1
2
Although not "ideal" you could probably change the orientation at run time when you go to the portrait screen and then switch back to landscape upon leaving that screen.
虽然不是“理想”,但是当您转到纵向屏幕然后在离开该屏幕时切换回横向时,您可能会在运行时更改方向。
For that you'd use Activity#setRequestedOrientation(int) in your MainActivity (or whatever you called your AndroidApplication
subclass). You'd likely want to define an interface for invoking this if you are following the normal LibGDX setup.
为此,您可以在MainActivity中使用Activity#setRequestedOrientation(int)(或者您称为AndroidApplication子类的任何内容)。如果您遵循正常的LibGDX设置,您可能希望定义一个用于调用此接口的接口。
You should get a resize event in which you can get set up for the new orientation (you'd no longer rotate your rendering or ad).
您应该获得一个调整大小事件,您可以在其中设置新方向(您不再旋转渲染或广告)。
Alternatively, you could redesign this one screen to be landscape like the rest of the app.
或者,您可以重新设计这个屏幕,使其像应用程序的其余部分一样风景。