Android自定义上拉控件SpringView
Demo
先看一下SpringView的效果图:

1.拖动灰色部分可拖动下方视图,点击jump按钮可让下方视图自行滑动。
使用方法
布局文件:
<com.zql.android.springview.SpringView
android:id="@+id/spring"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:background="#ff5533ff">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="30sp"
android:text="First View"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:background="#ffeeeeee">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="I am move holder"
android:gravity="center"
android:layout_centerInParent="true"
android:layout_gravity="left"/>
<Button
android:id="@+id/jump"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:text="jump"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:background="#ff553300">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="30sp"
android:text="Second View"/>
</LinearLayout>
</com.zql.android.springview.SpringView>
SpringView内部可以容纳两个或三个子view,当只有两个的时候,SringView会自动生成一个供拖拽的视图,当有三个的时候,会把第二个子view作为拖拽视图使用。建议使用三个子view,这样可以自定义拖拽的视图。
注意点:当使用三个子view的时候,第二个作为拖拽视图的布局要明确layout_height,不能使用match_parent或wrap_content。
SpringView的事件响应
public interface OnSpringListener{
//达到顶部时回调
void touchTop();
//达到底部时回调
void touchBottom();
}
SpringView自动滑动:
public void SpringView.jumpUp();
public void SpringView.jumpDown()
github
https://github.com/ZhangQinglian/Android-SpringView
Android自定义上拉控件SpringView的更多相关文章
- android 自定义空间 组合控件中 TextView 不支持drawableLeft属性
android 自定义空间 组合控件中 TextView 不支持drawableLeft属性.会报错Caused by: android.view.InflateException: Binary X ...
- (转载)Android自定义标签列表控件LabelsView解析
Android自定义标签列表控件LabelsView解析 作者 donkingliang 关注 2017.03.15 20:59* 字数 759 阅读 406评论 0喜欢 3 无论是在移动端的App, ...
- 自定义上传控件(兼容IE8)
上传控件是 <input type="file"/> 而实际开发过程中,都会自定义一个控件,因为这个控件本身难看,而且不同浏览器效果不一样. 如IE8显示如下: 谷歌浏 ...
- Android 自定义View修炼-如何打造Android自定义的下拉列表框控件
一.概述 Android中的有个原生的下拉列表控件Spinner,但是这个控件有时候不符合我们自己的要求, 比如有时候我们需要类似windows 或者web网页中常见的那种下拉列表控件,类似下图这样的 ...
- Android自定义View和控件之一-定制属于自己的UI
照例,拿来主义.我的学习是基于下面的三篇blog.前两是基本的流程,第三篇里有比较细致的绘制相关的属性.第4篇介绍了如何减少布局层次来提高效率. 1. 教你搞定Android自定义View 2. 教你 ...
- Android自定义控件进阶-打造Android自定义的下拉列表框控件
技术:Android+java 概述 Android中的有个原生的下拉列表控件Spinner,但是这个控件有时候不符合我们自己的要求, 比如有时候我们需要类似windows 或者web网页中常见的 ...
- Android 如何打造Android自定义的下拉列表框控件
一.概述 Android中的有个原生的下拉列表控件Spinner,但是这个控件有时候不符合我们自己的要求, 比如有时候我们需要类似windows 或者web网页中常见的那种下拉列表控件,类似下图这样的 ...
- Android自定义标签列表控件LabelsView解析
版权声明:本文为博主原创文章,未经博主允许不得转载. 无论是在移动端的App,还是在前端的网页,我们经常会看到下面这种标签的列表效果: 标签从左到右摆放,一行显示不下时自动换行.这样的效果用And ...
- [转]android 自定义圆形imageview控件
android布局 首先,定义定义圆形Imageview类: import android.content.Context; import android.graphics.Bitmap; imp ...
随机推荐
- 自实现部分string类的功能
#define _CRT_SECURE_NO_WARNINGS #include<iostream> using namespace std; class MyString { publi ...
- docker容器互连
三种方式 1.使用容器连接的示例如下: $ docker run --name some-app --link itbilu-mysql:mysql -d application-that-uses- ...
- C#通过webbrowser控件与javascript交互
1.C#里调用控件里面网页的js函数 //调用JavaScript的messageBox方法,并传入参数 object[] objects = new object[1]; o ...
- Hive查询表,返回数据全是NULL
情况1: hive> create table users(id int, name string); hive> load data local inpath '/usr/local/u ...
- [PIC32--IDE]Microchip PIC32开发环境的搭建
问题描写叙述 PIC32是Microchip推出的32 bit MCU,其内核是MIPS架构的,MIPS也是属于RISC指令集的,好像ARM的指令集还在RISC指令集中做了一些扩充,而MIPS应当是更 ...
- JS事件类型详解
一般事件 onclick IE3.N2 鼠标点击时触发 此事件 ondblclick IE4.N4 鼠标双击时触发 此事件 onmousedown IE4.N4 按下鼠标时触发 此事件 onmouse ...
- man手册页
man手册页不同页对应的内容: 区段1:用户指令区段2:系统调用区段3:程序库调用区段4:设备区段5:文件格式区段6:游戏区段7:杂项区段8:系统指令区段9:内核内部指令区段n:Tcl或Tk指令
- SQLServer 与 MySQL
SQL Server MySQL1.getdate() NOW() 2.top 100 ...
- 八大CMS内容管理系统推荐
cms系统哪个好 感谢 64320 的投递 时间:2015-03-05 来源:http://www.iisp.com/ztview/ID_16129.html?s=bios 耐思尼克 很多新手站长初次 ...
- js将秒数换算成时分秒
转载自:http://jingyan.baidu.com/article/375c8e19a0413925f2a229d2.html <script language="javascr ...