Android PopupWindow.showAsDropDown报错:BadTokenException: Unable to add window

Android PopupWindow.showAsDropDown报错:BadTokenException: Unable to add window

Android PopupWindow.showAsDropDown报错:

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?

在show之前前,多加一个判断拦截:

Kotlin 复制代码
你的viewAnchor.windowToken != null

Android PopupWindow_android popupwindow 获取resources-CSDN博客文章浏览阅读287次。代码:package zhangphil.test;import android.content.Context;import android.content.res.Resources;import android.graphics.Color;import android.os.Bundle;import android.support.annotation.Nullable..._android popupwindow 获取resourceshttps://blog.csdn.net/zhangphil/article/details/82850102

相关推荐
云水木石1 小时前
Android 的下一个战场:Windows 应用与游戏?
android·windows·游戏
雨声不在2 小时前
Android文字渐变的实现
android·textview
GoldenPlayer2 小时前
KTS语法
android
GoldenPlayer2 小时前
后台服务Service销毁逻辑+单例造成的内存泄露
android
GoldenPlayer2 小时前
自定义APK&gradle全局配置文件
android
うちは止水2 小时前
Android Hal层开发流程
android·hal
李小轰_Rex2 小时前
把手机变成听诊器!摄像头 30 秒隔空测心率 - 开箱即用
android·音视频开发
为码消得人憔悴4 小时前
Android perfetto - 记录分析memory
android·性能优化
尤老师FPGA4 小时前
使用ZYNQ芯片和LVGL框架实现用户高刷新UI设计系列教程(第四十二讲)
android·java·ui
成都大菠萝5 小时前
2-2-29 快速掌握Kotlin-过滤函数filter
android