Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rotate ad view with API 8

I am using OpenGL in a RenderSurface View in my android game. The Game uses landscape as screen orientation but I want to place the ad 90° rotated at the bottom of the phone. (As it would be if I use portrait as screen orientation)

This is the only way I can place the ad without making the game unplayable on small screens. I maneged to do this with:

View.rotate(..)

The problem is that this function is first available with the API Level 11.

  • Is there any workaround to to this with API Level 8?
  • I have already tried a rotate animation but touch events are not delivered correctly. (The adview prevents a workaround)

I would reduce my user base dramatically if my game is only playable with Android 3.0.

like image 291
Wayrunner Avatar asked Nov 13 '22 04:11

Wayrunner


1 Answers

I wonder if you couldnt do something like this? Sorry I don't have the time to test :/

    LinearLayout layout = new LinearLayout(this);

layout.setOrientation(LinearLayout.HORIZONTAL);

addContentView(layout, new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));

RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);    

adView = new AdView(this);

layout.addView(adView, adParams);

Since you are adding a content view over the opengl surfaceview perhaps.... well anyways like I said, no time to test it. give it a shot?

like image 96
WIllJBD Avatar answered Nov 16 '22 03:11

WIllJBD