2
我一直试图让它使用这个线程工作,但似乎无法得到它的工作。框架动画帮助Android
我试图让两个布局之间的屏幕交替,我已经试过很多从状态列表可绘制不同的东西,塑造可绘,甚至flipViews(flipViews没有工作,因为你不能改变背景,只是前景)。
现在我得到一个空指针。如果您想指出我无法在动画中使用布局,那么请这样做,因为这可能是问题,但我无法确定。 任何解决方案,以达到我的最终目标,表示赞赏。
我的onCreate包含以下(减去标准的东西)
ImageView mainimage = (ImageView) findViewById(R.id.main);
mainimage.setBackgroundResource(R.anim.blink);
AnimationDrawable blinkAnimation = (AnimationDrawable) mainimage.getBackground();
blinkAnimation.start();
我的动画文件包含此:(减去UTF东西)
<
animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/royalblue" android:duration="200" />
<item android:drawable="@drawable/blank" android:duration="200" />
</animation-list>
图像视图中的主要是绝对的牛逼这个空白的xml文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
这是我放置在绘制文件夹中的布局,因为我想它是在动画帧。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/blinkBlue"
android:background="@color/royalBlue"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
这是其他布局我已放置在抽拉文件夹,因为我希望它是在动画的帧。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/blinkBlack"
android:background="@color/black"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
具有u解决了这个问题还是仍在寻找答案? – 2011-11-19 09:43:58
使用AnimationDrawable时,您可以轻松地耗尽内存。我想出了一个用drawables来显示动画的类:http://stackoverflow.com/a/12519216/525319 – Yar 2012-09-20 19:11:58