getActivity / Xtoast
Licence: apache-2.0
Android 悬浮窗框架,好用不解释
Stars: ✭ 493
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Xtoast
Sweet Alert
A BEAUTIFUL, RESPONSIVE, CUSTOMIZABLE, ACCESSIBLE (WAI-ARIA) REPLACEMENT FOR JAVASCRIPT'S POPUP BOXES FOR LARAVEL
Stars: ✭ 696 (+41.18%)
Mutual labels: dialog, toast, popup
BalloonPopup
Forget Android Toast! BalloonPopup displays a round or squared popup and attaches it to a View, like a callout. Uses the Builder pattern for maximum ease. The popup can automatically hide and can persist when the value is updated.
Stars: ✭ 32 (-93.51%)
Mutual labels: dialog, popup, toast
Alerttoast
Create Apple-like alerts & toasts using SwiftUI
Stars: ✭ 151 (-69.37%)
Mutual labels: dialog, toast, popup
Razor.SweetAlert2
A Razor class library for interacting with SweetAlert2
Stars: ✭ 98 (-80.12%)
Mutual labels: dialog, popup, toast
Aiforms.dialogs
AiForms.Dialogs for Xamarin.Forms
Stars: ✭ 143 (-70.99%)
Mutual labels: dialog, toast, popup
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+2725.35%)
Mutual labels: dialog, toast, popup
plain-modal
The simple library for customizable modal window.
Stars: ✭ 21 (-95.74%)
Mutual labels: dialog, popup
neodigm55
An eclectic low-code vanilla JavaScript UX micro-library for those that defiantly think for themselves.
Stars: ✭ 14 (-97.16%)
Mutual labels: popup, toast
CustomPermissionsDialogue
Custom Permissions Dialogue is the only permissions library that supports ALL permission request scenarios. This library handles multiple edge cases such as not enabling all permissions or permanently rejecting a permission request.
Stars: ✭ 51 (-89.66%)
Mutual labels: dialog, popup
Icewm
A window manager designed for speed, usability, and consistency
Stars: ✭ 338 (-31.44%)
Mutual labels: window-manager, floating
denbun
Adjust showing frequency of Android app messages, and to be more user friendly 🐦
Stars: ✭ 17 (-96.55%)
Mutual labels: dialog, toast
Longpresspopup
Make a Popup appear long pressing on a view and handle drag-release events on its elements
Stars: ✭ 256 (-48.07%)
Mutual labels: dialog, popup
Vue Ydui
A mobile components Library with Vue2.js. 一只基于Vue2.x的移动端组件库。
Stars: ✭ 2,798 (+467.55%)
Mutual labels: dialog, popup
React Cool Portal
😎 🍒 React hook for Portals, which renders modals, dropdowns, tooltips etc. to <body> or else.
Stars: ✭ 458 (-7.1%)
Mutual labels: dialog, toast
Popupdialog
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
Stars: ✭ 3,709 (+652.33%)
Mutual labels: dialog, popup
悬浮窗框架
-
码云地址:Gitee
-
博客地址:悬浮窗需求终结者
-
已投入公司项目多时,没有任何毛病,可胜任任何需求,点击此处下载Demo
ToastUtils
本框架意在解决一些极端需求,如果是普通的 Toast 封装推荐使用集成步骤
dependencies {
// 悬浮窗框架:https://github.com/getActivity/XToast
implementation 'com.hjq:xtoast:6.6'
}
使用案例
- Java 用法
// 传入 Activity 对象表示设置成局部的,不需要有悬浮窗权限
// 传入 Application 对象表示设置成全局的,但需要有悬浮窗权限
new XToast<>(XToastActivity.this)
.setView(R.layout.toast_hint)
// 设置成可拖拽的
//.setDraggable()
// 设置显示时长
.setDuration(1000)
// 设置动画样式
//.setAnimStyle(android.R.style.Animation_Translucent)
// 设置外层是否能被触摸
//.setOutsideTouchable(false)
// 设置窗口背景阴影强度
//.setBackgroundDimAmount(0.5f)
.setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish)
.setText(android.R.id.message, "点我消失")
.setOnClickListener(android.R.id.message, new OnClickListener<TextView>() {
@Override
public void onClick(XToast toast, TextView view) {
// 点击这个 View 后消失
toast.cancel();
// 跳转到某个Activity
// toast.startActivity(intent);
}
})
.show();
- Kotlin 用法
XToast<XToast<*>>(activity)
.setView(R.layout.toast_hint)
// 设置成可拖拽的
//.setDraggable()
// 设置显示时长
.setDuration(1000)
// 设置动画样式
//.setAnimStyle(android.R.style.Animation_Translucent)
// 设置外层是否能被触摸
//.setOutsideTouchable(false)
// 设置窗口背景阴影强度
//.setBackgroundDimAmount(0.5f)
.setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish)
.setText(android.R.id.message, "点我消失")
.setOnClickListener(android.R.id.message, object : OnClickListener<TextView?> {
override fun onClick(toast: XToast<XToast<*>>, view: TextView?) {
// 点击这个 View 后消失
toast.cancel()
// 跳转到某个Activity
// toast.startActivity(intent);
}
})
.show()
没有悬浮窗权限如何全局显示?
-
没有悬浮窗权限是不能全局显示在其他应用上的,但是全局显示在自己的应用上是可以实现的
-
但是当前 Activity 创建的悬浮窗只能在当前 Activity 上面显示,如果想在所有的 Activity 都显示需要做特殊处理
-
我们可以通过 Application 来监听所有 Activity 的生命周期方法,然后在每个 Activity.onCreate 时创建悬浮窗
public final class FloatingLifecycle implements Application.ActivityLifecycleCallbacks {
static void with(Application application) {
application.registerActivityLifecycleCallbacks(new FloatingLifecycle());
}
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
new XToast<>(activity)
.setXXXX()
.show();
}
@Override
public void onActivityStarted(Activity activity) {}
@Override
public void onActivityResumed(Activity activity) {}
@Override
public void onActivityPaused(Activity activity) {}
@Override
public void onActivityStopped(Activity activity) {}
@Override
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {}
@Override
public void onActivityDestroyed(Activity activity) {}
}
框架亮点(原生 Toast 无法实现的功能)
-
支持自定义 Toast 动画样式
-
支持自定义 Toast 显示时长
-
支持监听 Toast 的显示和销毁
-
支持监听 Toast 中点击事件
-
支持一键开启 Toast 拖拽功能
-
支持 Toast 全局显示
作者的其他开源项目
-
安卓技术中台:AndroidProject
-
网络框架:EasyHttp
-
权限框架:XXPermissions
-
吐司框架:ToastUtils
-
标题栏框架:TitleBar
-
国际化框架:MultiLanguages
-
Gson 解析容错:GsonFactory
-
日志查看框架:Logcat
Android技术讨论Q群:78797078
微信公众号:Android轮子哥
如果您觉得我的开源库帮你节省了大量的开发时间,请扫描下方的二维码随意打赏,要是能打赏个 10.24 🐵就太👍了。您的支持将鼓励我继续创作
点击查看捐赠列表
License
Copyright 2019 Huang JinQun
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].