0

I've created an android app in a landscape orientation and have integrated mopub ads into it, I want the ads to run sideways down the left and right of the screen however when I set the xml layout to horizontal the text still runs from left the right and I'm left with a vertical banner that has a small box in the centre. I've tried using a rotation animation but when the ad rotates the test ad gets clipped and the text doesn't even appear inside the banner. The only solution I can think of is to turn the activity into portrait and rotate my openGL surface but that would mean I have to rewrite my entire openGl code to rotate everything. Just rotating the camera doesn't work either because I'd have to realign everything and rewrite my interface code.

Is there any way to make the mopub ad load in portrait and have my openGL load in landscape or any solution I haven't thought of that doesn't require me rewriting all my openGL code?

I found this, however I am programing for android and can make no sense of it

I'm currently using a LinearLayout using an xml.

Community
  • 1
  • 1

1 Answers1

0

You may try View.getMatrix(). The following code may do the trick:

Matrix m = adView.getMatrix();
m.postRotate(90);
m.postTranslate(adView.getWidth(), 0);

This assumes that view size is defined. Otherwise, instead of getWidth(), you need a fixed value like 50dp:

   float xShift = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
              50, activity.getResources().getDisplayMetrics());
    m.postTranslate(xShift, 0);

Good luck :)

cyanide
  • 3,885
  • 3
  • 25
  • 33
  • I'm get a runtime error, java.lang.IllegalStateException: Matrix can not be modified – Just Curious Sep 07 '15 at 09:07
  • Unfortunately View doesn't have setMatrix, however it has methods setPivotX, setPivotY, setRotation, setTranslationX, setTranslationY,You may try: setPivotX(width>>1); setPivotY(height>>1); setRotation(90), This will not give an error, but may not do what you need. – cyanide Sep 07 '15 at 09:38
  • Unfortunately I run into the same clipping issue as I do with the rotation animation, thanks for trying – Just Curious Sep 07 '15 at 12:11