可以使用的RelativeLayout或AbsoluteLayout发现机制,把图像(覆盖它的父)中,然后安装活动的当前布局。现在,如果您为该图片设置了动画,那么您的动画背景看起来就像动画。
例如,假设这是你的活动当前布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/vg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</LinearLayout>
现在这个布局看起来像以前的布局,可以为图像,它的ID是img1
设置动画(它似乎backgr:主要布局的ound) :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/vg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/img1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_x="0dp"
android:layout_y="0dp"
android:src="@drawable/bright_sun" />
<LinearLayout
android:id="@+id/vg2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</LinearLayout>
</RelativeLayout>
非常感谢您的回复......请问您能否简要描述如何为该图片设置动画? 猜猜将它设置为GIF动画不会有帮助吗? :) –
@brunolau我不确定你想要什么。你想有一个'Drawable Animation'(frame animation)或者你想执行'tweedned animation'吗?一个补间动画可以执行一系列简单的转换(position ,大小,旋转和透明度)在一个视图对象的内容 – hasanghaforian
嗨,我想使用帧动画...如果这意味着可绘制,那么它是一个 –