旋转 AdWhirl 布局

发布于 2024-12-19 07:52:06 字数 1406 浏览 1 评论 0原文

我想将 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 横幅? 谢谢!

示例图形 1 示例图形 2

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!

Sample graphic 1
Sample graphic 2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪荡不羁 2024-12-26 07:52:06

我不确定您的问题到底是什么,但有几点需要注意:

  1. AdWhirl 广告的宽度通常为 320dp。我不确定你是如何以 300dp 宽度重新获得广告的,但这可能是它没有填充宽度的部分原因。我会尝试将其更改为 320dp。

  2. 这张图片中显示的广告似乎移出了屏幕。您是否尝试过使用 pivotXpivotY 属性?

I'm not sure exactly what your issue is, but here are a couple things to note:

  1. 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.

  2. The ad shown in this picture seems to be shifted off the screen. Have you tried playing around with the pivotX and pivotY properties?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文