美文网首页
动画·界面

动画·界面

作者: _人间客 | 来源:发表于2016-07-29 18:25 被阅读8次

一、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"

相关文章

网友评论

      本文标题:动画·界面

      本文链接:https://www.haomeiwen.com/subject/swmzjttx.html