android控件名,介绍一个名为Dragger的android控件
前言
最近在做一个项目的时候要求使用一个弹出的效果,正好遇见如下的一个效果,
感觉效果很好看就用了
项目地址如下:Dragger
开始使用:(开发环境为Android Studio)
在你的build.gradle文件中添加如下内容
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.ppamorim:dragger:1.2'
}
新建一个Main2Activity
activity_main2.xml
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="16dp"
android:src="@mipmap/dragger"
android:background="@color/gray"/>
Main2Activity.java
public class Main2Activity extends DraggerActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
DraggerView draggerView = (DraggerView) findViewById(R.id.dragger_view);
draggerView.setDraggerPosition(DraggerPosition.BOTTOM);
}
}
修改MainActivity.java
在activity_main.xml中添加一个button后在MainActivity.java里面添加如下代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btn = (Button) findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, Main2Activity.class);
startActivity(intent);
}
});
}
解释
新建的Main2Activity其实就是那个效果中弹出的Activity,通过MainActivity中的按钮跳转到Main2Activity后执行
draggerView的setDraggerPosition的方法,其中参数为DraggerPosition.BOTTOM表示的是向下弹出,其他几种详见官方的例子
一些其他可以使用的方法
setDraggerCallback(DraggerCallback) //Interface that's provides some infos of the animation.
setSlideEnabled(boolean) //Enable or disable the drag, useful to use with ScrollViews.
setHorizontalDragRange(float) //Draggable distance that the draggableView can use, horizontally.
setVerticalDragRange(float) //Draggable distance that the draggableView can use, vertically.
setRunAnimationOnFinishInflate(boolean) //Run the initial animation, useful if you only want the drag function.
setDraggerLimit(float) //Set the max limit drag, default is 0.5 (center of the screen).
setDraggerPosition(DraggerPosition) //Set the position of archor.
setTension(float) //Tension of the animation. This represent with the friction, how much time the animation will be executed.
setFriction(float) //Friction of the animation. This represent with the tension, how much friction is applied at the tension animation.
show() //Show the drag view with Rebound animation.
closeActivity() //Simply close the activity with Rebound animation, based of the DraggerPosition choosen.
android控件名,介绍一个名为Dragger的android控件相关推荐
- android java 时间测试方法_一个让你开挂的Android 性能测试方法
Android性能测试,跟pc性能测试一样分为客户端及服务器,但在客户端上的性能测试分为2类,对于应用性能测试,包括很多测试项,如启动时间.内存.CPU.GPU.功耗.流量等.但针对rom版本的性能测 ...
- android播放视频来源库,一个强悍而优美的Android视频播放器
最近项目中有需要用在线视频播放.之前有关于视频播放介绍了一些工具使用.如ijkplayer ,ExoPlayer,Vitamio,android-UniversalMusicPlayer. 想要了解更 ...
- android视频播放器 http 206,一个强悍而优美的Android视频播放器
最近项目中有需要用在线视频播放.之前有关于视频播放介绍了一些工具使用.如ijkplayer ,ExoPlayer,Vitamio,android-UniversalMusicPlayer. 想要了解更 ...
- android 日志框架封装,FLog: 一个基于函数组合的Android日志框架,拥有极简的结构和极高的灵活性、扩展性...
FLog 一个基于函数组合的Android日志框架,拥有极简的结构和极高的灵活性.扩展性 下载 在根目录下的build.gradle中添加jitpack.io的maven地址 allprojects ...
- android ui风格 车载,XUI: 一个简洁而优雅的Android原生UI框架,解放你的双手!
XUI 一个简洁而又优雅的Android原生UI框架,解放你的双手!还不赶紧点击使用说明文档,体验一下吧! 涵盖绝大部分的UI组件:TextView.Button.EditText.ImageView ...
- wps android 版 参数控制介绍,最强手机办公软件 Android版金山WPS首评测
[天极网手机频道]从智能手机在市场流行那一刻开始,注定在我们的生活工作将发生重大改变,对于智能手机来说强大的硬件支持与智能平台的兼容行决定在,手机的各项功能已经逐步趋于PC化,而对于日常上班族来说,随 ...
- Android MVP模式简单易懂的介绍方式 (一)
Android MVP模式简单易懂的介绍方式 (一) Android MVP模式简单易懂的介绍方式 (二) Android MVP模式简单易懂的介绍方式 (三) 最近正在研究Android的MVP模式 ...
- Android build.gradle(app)介绍
/**首先第一行应用了一个插件,一般有两个值可选,com.android.application表示这是一个应用程序模块,* com.android.library表示这是一个库模块.应用模块和库模块 ...
- Android build.gradle文件详解(转述自《Android第一行代码》第二版)
Android build.gradle文件详解 1. 最外层目录下的build.gradle文件 1.1 repostories 1.2 dependencies 2. app目录下的build.g ...
最新文章
- zabbix监控haproxy
- maven 私服的使用及settings.xml的配置
- leetcode 303. Range Sum Query - Immutable | 303. 区域和检索 - 数组不可变(一维前缀和问题)
- Word Count作业
- * poj 1062 昂贵的礼物 dijkstra 枚举区间
- ext Grid(三)
- 剑指offer 面试题59 - II. 队列的最大值
- html input type=quot;filequot;,input[type='file']默认样式
- Jmeter参数化HTTP request中Send Files With The Request的文件路径和文件名
- 2021年四川省卫生副高考试成绩查询时间,2021年四川卫生资格成绩查询时间及查分入口【6月4日起】...
- relocation R_X86_64_PC32 against symbol ff_pw_9 can not be used when making a shared object
- Atitit.远程文件技术 webdav ftp scp ssh-sftp http nfs smb 的区别与总结
- 多目标跟踪的评价指标
- Mac OS系统怎么修改mac地址
- [书籍翻译]12周撰写期刊文章 学术出版成功指南——第 1 周:设计写作计划
- 从ChatGPT到ChatCAD:基于大型语言模型的医学图像交互式计算机辅助诊断
- 一梦江湖网页提交问题服务器错误,一梦江湖4月3日更新内容详情一览
- Jsp+mysql在线考试系统论文
- 管理会计习题集及答案 1-4章
- python-docx 设置表格边框
热门文章
- dma接收双缓存 stm32_STM32和WM8960 I2S 利用DMA双缓冲音频播放和录音(二)
- 嵌入式 LED 万年历
- 注册宝网络验证系统,安全免费的网络验证系统
- fastadmin_短信宝插件_验证码发送、注册、登录
- 【软件测试】性能测试、负载测试、压力测试
- 关于在python中安装turtle出现的一些问题
- 【Unity】实现镜头虚化模糊效果(Blur):camera模糊,UGUI模糊,FairyGUI模糊效果
- react native 震动 Vibration 使用详解
- 地下城与勇士(DNF)洛兰副本(洛兰、洛兰深处、比尔马克帝国试验场、悲鸣洞穴)(童年的回忆)
- Linux 应急响应流程及实战演练