实现Android界面滚动时控件随着淡出:Discrollview

jopen 10年前

实现在滚动Android界面时,界面的部件会逐渐淡出、平移或者缩放。效果如下动画:Animated gif
使用示例:

<com.flavienlaurent.discrollview.lib.DiscrollView      xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:discrollve="http://schemas.android.com/apk/res-auto"      android:layout_width="match_parent"      android:layout_height="match_parent">        <com.flavienlaurent.discrollview.lib.DiscrollViewContent          android:layout_width="match_parent"          android:layout_height="match_parent">            <TextView              android:layout_width="match_parent"              android:layout_height="600dp"              android:background="@android:color/white"              android:textColor="@android:color/black"              android:padding="25dp"              android:textSize="72sp"              android:gravity="center"              android:fontFamily="serif"              android:text="Do you love cheese?" />            <View              android:layout_width="match_parent"              android:layout_height="200dp"              android:background="#007788"              discrollve:discrollve_alpha="true"              discrollve:discrollve_threshold="0.3" />            <ImageView              android:layout_width="200dp"              android:layout_height="120dp"              discrollve:discrollve_alpha="true"              discrollve:discrollve_translation="fromLeft|fromBottom"              android:src="@drawable/cheese1" />            <View              android:layout_width="match_parent"              android:layout_height="200dp"              discrollve:discrollve_fromColor="#88EE66"              discrollve:discrollve_toColor="#000000" />            <ImageView              android:layout_width="220dp"              android:layout_height="110dp"              android:layout_gravity="right"              android:src="@drawable/cheese2"              discrollve:discrollve_translation="fromRight" />            <TextView              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:padding="20dp"              android:fontFamily="serif"              android:gravity="center"              android:text="When the cheese comes out everybody's happy pecorino red leicester"              android:textSize="18sp"              discrollve:discrollve_alpha="true"              discrollve:discrollve_translation="fromBottom" />            <ImageView              android:layout_width="wrap_content"              android:layout_height="wrap_content"              android:layout_margin="20dp"              android:layout_gravity="center"              android:src="@drawable/ilovecheese_heart"              discrollve:discrollve_scaleX="true"              discrollve:discrollve_scaleY="true"  />        </com.flavienlaurent.discrollview.lib.DiscrollViewContent>  </com.flavienlaurent.discrollview.lib.DiscrollView>

项目主页:http://www.open-open.com/lib/view/home/1392016571645