Move Adview To Bottom, Cocos2dx Activity
Help me please to move ads to bottom of the screen Cocos2dxActivity.this.adView = new AdView(Cocos2dxActivity.this, AdSize.SMART_BANNER, mediationId()); @Suppr
Solution 1:
Note : this is in regard to cocos2d-x 3.1.1, though earlier versions should be similar in regard to this.
Cocos2dxActivity uses a FrameLayout
as its top most layout. In order to achieve what you want, this has be changed to a RelativeLayout
- in Cocos2dxActivity class, there is an init()
method which you should edit. There is also a class variable called mFrameLayout
- just change its type to RelativeLayout
and name accordingly, and your IDE should tell you where else to change.
As to the banner itself you should give it this layout parameters when adding it to the RelativeLayout
:
RelativeLayout.LayoutParams relParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
relParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
relParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
Post a Comment for "Move Adview To Bottom, Cocos2dx Activity"