我正在尝试为视图的高度和宽度设置动画。视图的目标高度和宽度大于屏幕,但视图的动画大于屏幕大小。视图一直增长,直到达到屏幕高度,然后停止。
这是我的代码:
private void openMenu6() {
ValueAnimator anim = ValueAnimator.ofInt(0, AppData.height * 10);
anim.setDuration(500);
anim.setInterpolator(new AccelerateInterpolator());
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
circle2.getLayoutParams().height = (int) animation.getAnimatedValue();
circle2.getLayoutParams().width = (int) animation.getAnimatedValue();
circle2.requestLayout();
}
});
anim.start();
openMenu = !openMenu;
}
XML:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:background="#FFFFFF"
tools:context="classes.Blog">
<RelativeLayout
android:id="@+id/mainContent"
android:layout_width="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_height="wrap_content">
<include layout="@layout/main_list" />
<include layout="@layout/fullscreensliderpage" />
<include layout="@layout/readlaterpage" />
<include layout="@layout/searchpage" />
<include layout="@layout/webviewpage" />
<include layout="@layout/twitterpage" />
<include layout="@layout/settingspage" />
<RelativeLayout
android:id="@+id/menuButtonContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true">
<classes.Circle
android:id="@+id/circle2"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#000000"
android:visibility="gone" />
<classes.Circle
android:id="@+id/menuCircle"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:visibility="gone" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="22dp"
android:background="@drawable/menu_button" />
</RelativeLayout> ...