最近打算学习一些开源库,正好碰到了晴天这款天气应用,个人就感觉界面很不错
Discrollview库的地址:https://github.com/flavienlaurent/discrollview
也不是做广告,觉得好的东西就该大家一起学习进步:),当然自己也不会拿去做商用,只是学习开源库的使用
首先是第一次进入界面的界面,这里使用了Discrollview这个库,滑动的时候会出现控件渐变颜色和弹出来的效果
从上往下划一次显示你填充的控件
代码如下:
xmlns:discrollve="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:scrollbars="none" >
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_width="match_parent"
android:layout_height="400dp"
android:background="@android:color/white"
android:fontFamily="serif"
android:gravity="center"
android:padding="25dp"
android:text="好天气 好心情"
android:textColor="@android:color/black"
android:textSize="45sp"
android:textStyle="bold" />
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:contentDescription="@string/app_name"
android:scaleType="centerInside"
android:src="@drawable/fineday"
discrollve:discrollve_alpha="true"
discrollve:discrollve_scaleX="true"
discrollve:discrollve_scaleY="true"
discrollve:discrollve_translation="fromTop" />
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@color/comm_3"
discrollve:discrollve_alpha="true"
discrollve:discrollve_threshold="0.3" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/w1_s"
discrollve:discrollve_alpha="true"
discrollve:discrollve_translation="fromLeft
fromBottom" />
android:layout_width="match_parent"
android:layout_height="200dp"
discrollve:discrollve_fromBgColor="@color/comm_2"
discrollve:discrollve_toBgColor="#000000" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/w1_m"
discrollve:discrollve_translation="fromRight" />
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="serif"
android:gravity="center"
android:padding="20dp"
android:text="这是一款开源天气软件"
android:textSize="10sp"
discrollve:discrollve_alpha="true"
discrollve:discrollve_translation="fromBottom" />
android:id="@+id/enterMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:minHeight="50dp"
android:minWidth="140dp"
android:text="Go!"
android:textColor="@color/white" />
这个效果真的不错,可以使用到好多app里面的开始界面!不懂的可以问我