Skip to content

Repository files navigation

FloatingOverlayView

Floating view with draw over other apps it uses system alert window with the permission android.permission.SYSTEM_ALERT_WINDOW under the hood

Download

Demo

Build

Step 1. Add the JitPack repository to your build file
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.javaherisaber:FloatingOverlayView:1.0.2'
}

Usage

Layout.xml

Step 1. Create layout and don't forget add id (root_container) like this
<?xml version="1.0" encoding="utf-8"?>
<FrameLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent">
<FrameLayoutandroid:id="@+id/root_container"android:layout_width="250dp"android:layout_height="200dp">
....
</FrameLayout>
</FrameLayout>

Kotlin/Java

Step 2. Create FloatingOverlayView
FloatingOverlayView(context, R.layout.view_overlay)
.setXOffset(800) // move the banner to the right side
.setOnCreateListener { layout:FloatingOverlayView, view:View->// do something with `view`, maybe a close button
}
.setOnCloseListener {
// do something after the banner is closed
}
.create()

About

Floating view to draw over other apps

Resources

Stars

19 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages