动画·界面

一、activity_main.xml


进入动画

采用RelativeLayout布局,只含一个TextView控件,宽高采用match_parent,在textView里添加背景图片和文字。

android:background="@drawable/start_bg"

android:gravity="center"//使文字居中

android:text="嫦\n娥\n的\n故\n事"

二、activity_rocket_show.xml


主界面

采用RelativeLayout总布局,布局里添加背景图片。内含两个ImageView(roc_boom_img & roc_rocket_img)和两个Button(roc_shoot_btn & roc_rocket_fire_btn)。

(一)roc_boom_img

bomb_animation是帧动画,需要先在xml文件里配置。

android:layout_width="120dp"//wrap_content:原有的大小有点小

android:layout_height="wrap_content"

android:background="@drawable/bomb_animation"//在background里引入动画

android:visibility="gone"//先设为不可见

(二)roc_rocket_img

rocket_fire_animation是帧动画,height和width都用wrap{_content即可,依凭父控件定位。

android:layout_alignParentBottom="true"

android:background="@drawable/rocket_fire_animation"

(三)roc_shoot_btn

height和width都用wrap{_content,依凭父控件定位。

android:layout_alignParentBottom="true"

android:layout_alignParentRight="true"

(四)roc_rocket_fire_btn

height和width都用wrap{_content,依凭父控件和shoot_btn定位。

android:layout_alignParentBottom="true"

android:layout_toLeftOf="@+id/roc_shoot_btn"

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容