我想将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" />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);问题是,第一个显示的横幅有时看起来很好(正确旋转)。接下来,刷新的横幅只显示其中的一小部分(约占整个图形宽度的25%)。我尝试了不同的方法,但都不能很好地工作。
有没有更好的方法来正确旋转AdWhirl横幅?谢谢!


发布于 2011-12-03 02:35:07
我不确定你的问题到底是什么,但这里有几件事需要注意:
pivotX和pivotY属性?https://stackoverflow.com/questions/8346292
复制相似问题