android关电视效果

首先,布局文件的写法。有很多

1.要求屏幕瞬间白屏。
2.白色屏幕以匀加速或匀减速向中间挤压,直至一条白线后消失不见,整个过程大概200毫秒。
3.露出黑漆漆一片的黑色背景。

种,最简单的就是利用RelativeLayout或者FrameLayout为应用首界面的根布局,如果应用的背景色本身为黑色最好,就像优酷一样。如果应用的背景色不为黑色,那么在根布局里写一个

Code<FrameLayout android:id="@+id/fl_off" android:layout_width="fill_parent" android:layout_height="fill_parent" android:visibility="gone" > <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/black" /> <ImageView android:id="@+id/iv_off" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:visibility="gone" /> </FrameLayout>

第一个ImageView为黑色的背景色,第二个为白色的背景色。

 

下面是动画的xml

Code<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false" android:zAdjustment="top" > <scale android:duration="200" android:fromXScale="1.0" android:fromYScale="1.0" android:interpolator="@android:anim/accelerate_interpolator" android:pivotX="50.0%" android:pivotY="50.0%" android:toXScale="1.0" android:toYScale="0.0030" /> <scale android:duration="200" android:fromXScale="1.0" android:fromYScale="1.0" android:interpolator="@android:anim/accelerate_interpolator" android:pivotX="50.0%" android:pivotY="50.0%" android:startOffset="200" ///设置在多少毫秒后开始 android:toXScale="0.0" android:toYScale="0.3" /> <alpha android:duration="400" android:fillAfter="true" android:fillEnabled="true" android:fromAlpha="1.0" android:interpolator="@interpolator/accelerate_quint" android:toAlpha="0.0" /> </set>

下面是加速器

Code<?xml version="1.0" encoding="utf-8"?> <accelerateInterpolator xmlns:android="http://schemas.android.com/apk/res/android" android:factor="2.5" />

你可能感兴趣的:(android,关电视)