如何显示垂直横向模式AdMob的广告? (安卓)横向、模式、广告、AdMob

2023-09-09 22:11:11 作者:-峩姓装请叫峩纯纯

我要显示AdMob的广告如下所示。我的游戏被锁定在横向模式下,我想垂直显示广告。我使用的XML布局,把我的广告。

I want to show the admob ads like the following. My game is locked in landscape mode, and I want to show the ads vertically. I used the XML layout to placed my ads.

推荐答案

要做到这一点,你必须创建一个自定义视图扩展了AdMob的视图,然后覆盖的OnDraw()方法。由于没有为AdMob的视图没有源$ C ​​$ C可(据我所知),但是,这是不可能的。如果你有AdMob广告的OnDraw()方法的来源,它可能是交换x和y变量的简单问题。

To do this, you would have to create a custom View that extends the AdMob View, then override the onDraw() method. Because there is no source code available for the AdMob View (that I know of), however, this may be impossible. If you had the source of the AdMob onDraw() method, it could be simply an issue of swapping the x and y variables.

另一种方法是,让您的活动在波泰特模式,然后重写你自己的看法的OnDraw()方法来绘制的风景线。这将是一个很大的工作,虽然,因为你必须创建自己的自定义视图按钮,图像的布局等。

Another option is to keep your Activity in Portait mode, and then override your own Views' onDraw() method to draw it in landscape. This would be a lot of work though, as you'd have to create your own custom views for buttons, image layouts, etc.