Git Product home page Git Product logo

xfloatview's Introduction

XFloatView

xfv api

一个简易的悬浮窗实现方案

关于我

github csdn

特征

  • 支持自定义布局的悬浮窗。

  • 支持自定义拖动事件、点击事件。

  • 支持悬浮窗自动吸附效果。

  • 支持初始化悬浮窗的位置。

  • 支持悬浮窗翻转吸附。


1、演示(请star支持)

1.1、Demo演示动画

1.2、Demo下载

downloads

2、如何使用

目前支持主流开发工具AndroidStudio的使用,直接配置build.gradle,增加依赖即可.

2.1、Android Studio导入方法,添加Gradle依赖

1.先在项目根目录的 build.gradle 的 repositories 添加:

allprojects {
     repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

2.然后在dependencies添加:

dependencies {
  ...
  implementation 'com.github.xuexiangjys:XFloatView:1.0.1'
}

2.2、继承XFloatView,实现自定义窗体

主要需要实现如下抽象方法:

/**
 * @return 获取根布局的ID
 */
protected abstract int getLayoutId();

/**
 * @return 能否移动或者触摸响应
 */
protected abstract boolean canMoveOrTouch();

/**
 * 初始化悬浮控件
 */
protected abstract void initFloatView();

/**
 * 初始化监听
 */
protected abstract void initListener();

/**
 * @return 设置悬浮框是否吸附在屏幕边缘
 */
protected abstract boolean isAdsorbView();

点击查看示例代码

2.3、悬浮窗的权限申请

FloatWindowPermission.getInstance().applyFloatWindowPermission(getContext());

联系方式

xfloatview's People

Contributors

xuexiangjys avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.