问题
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.
回答1:
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.
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.
来源:https://stackoverflow.com/questions/5684097/how-to-show-admob-ads-vertical-in-landscape-mode-android