其实所谓像关电视一样的退出效果就是一个动画而已,好吧,看到这里的朋友可以先自己想想,其实思路是很简单的。

1.要求屏幕瞬间白屏。
2.白色屏幕以匀加速或匀减速向中间挤压,直至一条白线后消失不见,整个过程大概200毫秒。
3.露出黑漆漆一片的黑色背景。
首先,布局文件的写法。有很多种,最简单的就是利用RelativeLayout或者FrameLayout为应用首界面的根布局,如果应用的背景色本身为黑色最好,就像优酷一样。如果应用的背景色不为黑色,那么在根布局里写一:
- Android:id="@+id/fl_off"
 - android:layout_width="fill_parent"
 - android:layout_height="fill_parent"
 - android:visibility="gone"
 - >
 - android:layout_width="fill_parent"
 - android:layout_height="fill_parent"
 - android:background="@color/text_black" />
 - android:id="@+id/iv_off"
 - android:layout_width="fill_parent"
 - android:layout_height="fill_parent"
 - android:background="@color/text_white"
 - android:visibility="gone"/>
 
第一个ImageView为黑色的背景色,第二个为白色的背景色。
下面是动画文件的写法 res/anim/tv_off.xml:
- android:zAdjustment="top"
 - xmlns:android="http://schemas.android.com/apk/res/android">
 - android:duration="200"
 - android:pivotX="50.0%"
 - android:pivotY="50.0%"
 - android:fromXScale="1.0"
 - android:toXScale="1.0"
 - android:fromYScale="1.0"
 - android:toYScale="0.0030" />
 - android:duration="200"
 - android:pivotX="50.0%"
 - android:pivotY="50.0%"
 - android:startOffset="200"
 - android:fromXScale="1.0"
 - android:toXScale="0.0"
 - android:fromYScale="1.0"
 - android:toYScale="0.3" />
 - android:duration="400"
 - android:fillAfter="true"
 - android:fromAlpha="1.0"
 - android:toAlpha="0.0"
 - android:fillEnabled="true" />
 
这个很简单,大家copy就行了。
因为动画引用到了加速器,下面是加速器文件的写法 res/interpolator/accelerate_quint.xml:
- xmlns:android="http://schemas.android.com/apk/res/android" />
 
这是一个匀加速的加速器,加速倍数为2.5。
                名称栏目:模拟优酷像关电视一样的退出效果
                
                网页URL:http://www.csdahua.cn/qtweb/news40/324340.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网