前言

最近在做一个项目的时候要求使用一个弹出的效果,正好遇见如下的一个效果,

感觉效果很好看就用了

项目地址如下: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控件相关推荐

  1. android java 时间测试方法_一个让你开挂的Android 性能测试方法

    Android性能测试,跟pc性能测试一样分为客户端及服务器,但在客户端上的性能测试分为2类,对于应用性能测试,包括很多测试项,如启动时间.内存.CPU.GPU.功耗.流量等.但针对rom版本的性能测 ...

  2. android播放视频来源库,一个强悍而优美的Android视频播放器

    最近项目中有需要用在线视频播放.之前有关于视频播放介绍了一些工具使用.如ijkplayer ,ExoPlayer,Vitamio,android-UniversalMusicPlayer. 想要了解更 ...

  3. android视频播放器 http 206,一个强悍而优美的Android视频播放器

    最近项目中有需要用在线视频播放.之前有关于视频播放介绍了一些工具使用.如ijkplayer ,ExoPlayer,Vitamio,android-UniversalMusicPlayer. 想要了解更 ...

  4. android 日志框架封装,FLog: 一个基于函数组合的Android日志框架,拥有极简的结构和极高的灵活性、扩展性...

    FLog 一个基于函数组合的Android日志框架,拥有极简的结构和极高的灵活性.扩展性 下载 在根目录下的build.gradle中添加jitpack.io的maven地址 allprojects ...

  5. android ui风格 车载,XUI: 一个简洁而优雅的Android原生UI框架,解放你的双手!

    XUI 一个简洁而又优雅的Android原生UI框架,解放你的双手!还不赶紧点击使用说明文档,体验一下吧! 涵盖绝大部分的UI组件:TextView.Button.EditText.ImageView ...

  6. wps android 版 参数控制介绍,最强手机办公软件 Android版金山WPS首评测

    [天极网手机频道]从智能手机在市场流行那一刻开始,注定在我们的生活工作将发生重大改变,对于智能手机来说强大的硬件支持与智能平台的兼容行决定在,手机的各项功能已经逐步趋于PC化,而对于日常上班族来说,随 ...

  7. Android MVP模式简单易懂的介绍方式 (一)

    Android MVP模式简单易懂的介绍方式 (一) Android MVP模式简单易懂的介绍方式 (二) Android MVP模式简单易懂的介绍方式 (三) 最近正在研究Android的MVP模式 ...

  8. Android build.gradle(app)介绍

    /**首先第一行应用了一个插件,一般有两个值可选,com.android.application表示这是一个应用程序模块,* com.android.library表示这是一个库模块.应用模块和库模块 ...

  9. Android build.gradle文件详解(转述自《Android第一行代码》第二版)

    Android build.gradle文件详解 1. 最外层目录下的build.gradle文件 1.1 repostories 1.2 dependencies 2. app目录下的build.g ...

最新文章

  1. java填空题 在非静态成员方法中_Java程序设计填空和改错题(参考答案)
  2. 第一份工作是选择安逸,还是勇敢尝试?
  3. html input不能输入小数_第三课:变量与输入输出的配合使用
  4. 【JavaScript】判断一个字符串是否是数值 / 判断是否包含字母(附常用正则表达式)
  5. TechEmpower 13轮测试中的ASP.NET Core性能测试
  6. ASP.NET使用管道模型(PipleLines)处理HTTP请求
  7. 五个非常实用的自然语言处理资源
  8. 灵云语音识别(ASR)实现实时识别
  9. matlab2c使用c++实现matlab函数系列教程-max函数
  10. Redhat5.2yum源更新为centos源
  11. 某酷kux文件转mp4方法
  12. 闲聊一下android 3D 网络游戏
  13. 电平转换小结(避免翻车指南)
  14. 斐波那契数列(python)
  15. 笔记整理--Linux守护进程
  16. [论文笔记] 大型车牌检测数据集CCPD 阅读笔记
  17. 在计算机中将硬盘上的数据复制到u盘上称为,怎样将旧电脑所有数据(包括系统盘数据),全部复制到新电脑上?...
  18. 如何用ajax实现页面自动刷新,Ajax实现页面自动刷新实例解析
  19. 时代中国三年“老去” 岑钊雄500强空梦一场
  20. mp3与wav格式的互转

热门文章

  1. reCAPTCHA v3 验证
  2. ios系统微信H5页面背景音乐自动播放
  3. UE4 材质切换(带动画效果)
  4. Spring boot 集成 ureport (三) 报表存储至数据库
  5. python easygui模块_easygui模块放在哪里?
  6. c语言联想输入法算法,华为:编程实现联想输入法 输入联想功能是非常实用的一个功能,请编程实现类似功能...
  7. 机电系统计算机设计试题,东大20年7月考试《机电一体化系统设计》考核作业【标准答案】...
  8. 电脑不能自动配置dns服务器,电脑上的dns服务器怎么设置
  9. python字典zip函数_Python zip函数及用法
  10. 基于微信小程序奶茶店在线点餐下单系统