旋转 AdWhirl 布局
我想将 AdWhirl 横幅旋转 -90 度。 因此,横幅视图应在左侧垂直查看。
我的第一个想法是重写 onDraw 方法并将旋转逻辑放入其中,但我没有发现任何可能重写 adwhirl 中的任何绘图功能。
但是,我使用动画器旋转了“com.adwhirl.AdWhirlLayout”,如下所示:
<com.adwhirl.AdWhirlLayout
android:id="@+id/adwhirl_layout"
android:layout_width="300dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:animationCache="false"
android:layout_height="53dp" />
旋转器 XML:
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="-90"
android:pivotX="10%"
android:pivotY="50%"
android:duration="0"
android:fillEnabled="false"
android:fillAfter="true"/>
Java:
AdWhirlLayout mAdWhirlLayout = (AdWhirlLayout) findViewById(R.id.adwhirl_layout);
Animation animation = AnimationUtils.loadAnimation(this, R.animator.rotate);
mAdWhirlLayout.setAdWhirlInterface(new CustomEvents(mAdWhirlLayout, this, getApplicationContext()));
mAdWhirlLayout.startAnimation(animation);
问题是,第一个显示的横幅有时看起来不错(正确旋转)。 接下来,刷新的横幅仅显示其中的一小部分(约总图形宽度的 25%)。 我尝试了不同的方法,但效果都不好。
有没有更好的方法来正确旋转 AdWhirl 横幅? 谢谢!
i want to rotate the AdWhirl Banner -90 degrees.
The Banner-view should therefore viewed vertical on the left side.
My first idea was to override the onDraw Methode and put in there the logic to rotate, but I didnt found any possibility to override any drawing functionality in adwhirl.
However, i rotated the "com.adwhirl.AdWhirlLayout" with an Animator as follows:
<com.adwhirl.AdWhirlLayout
android:id="@+id/adwhirl_layout"
android:layout_width="300dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:animationCache="false"
android:layout_height="53dp" />
The Rotator XML:
<?xml version="1.0" encoding="utf-8"?>
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="-90"
android:pivotX="10%"
android:pivotY="50%"
android:duration="0"
android:fillEnabled="false"
android:fillAfter="true"/>
Java:
AdWhirlLayout mAdWhirlLayout = (AdWhirlLayout) findViewById(R.id.adwhirl_layout);
Animation animation = AnimationUtils.loadAnimation(this, R.animator.rotate);
mAdWhirlLayout.setAdWhirlInterface(new CustomEvents(mAdWhirlLayout, this, getApplicationContext()));
mAdWhirlLayout.startAnimation(animation);
The Problem is, that the first displayed banner looks sometimes good (correct rotated).
Following, refreshed banners are only displayed a small piece of it (~25% width of the total graphic).
I tried different things, but nothing works well.
Is there any better way to rotate the AdWhirl Banner correctly?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您的问题到底是什么,但有几点需要注意:
AdWhirl 广告的宽度通常为 320dp。我不确定你是如何以 300dp 宽度重新获得广告的,但这可能是它没有填充宽度的部分原因。我会尝试将其更改为 320dp。
这张图片中显示的广告似乎移出了屏幕。您是否尝试过使用
pivotX
和pivotY
属性?I'm not sure exactly what your issue is, but here are a couple things to note:
AdWhirl Ads are usually a 320dp width. I'm not sure how you're even getting ads back with 300dp width, but that may be a part of the reason it doesn't fill the width. I would try changing this to 320dp.
The ad shown in this picture seems to be shifted off the screen. Have you tried playing around with the
pivotX
andpivotY
properties?