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

寵の児 提交于 2020-01-01 19:35:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!