Drawable animation可以加载Drawable资源实现帧动画。AnimationDrawable是实现Drawable animations的基本类。

这里用AnimationDrawable 简单模拟动态图的实现。

 

fragment_main 布局文件 ----  只需要放一个 ImageView即可

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     xmlns:tools="http://schemas.android.com/tools"
 3     android:layout_width="match_parent"
 4     android:layout_height="match_parent"
 5     tools:context="com.yztc.frameanimation.MainActivity" >
 6 
 7     <ImageView
 8         android:id="@+id/iv_frame"
 9         android:layout_width="match_parent"
10         android:layout_height="200dp"
11         android:background="@drawable/girl_and_boy" />
12 
13 </RelativeLayout>
fragment_main

相关文章:

  • 2021-10-06
  • 2022-12-23
  • 2021-12-15
  • 2021-07-28
  • 2021-10-07
  • 2022-01-15
  • 2021-09-20
猜你喜欢
  • 2022-12-23
  • 2021-05-26
  • 2021-04-09
  • 2021-11-28
  • 2021-11-14
  • 2022-12-23
  • 2021-08-05
相关资源
相似解决方案