ycz ycz - 6 months ago 49
Android Question

How to show admob ads vertical in landscape mode? (Android)

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.

enter image description here


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.