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

相关推荐
alexhilton3 分钟前
在Compose中用Shader实现透明的粘稠元球效果
android·kotlin·android jetpack
jwn9991 小时前
Laravel5.x核心特性全解析
android·php·laravel
studyForMokey3 小时前
【Android面试】RecylerView专题
android·spring·面试
android_cai_niao4 小时前
Android中有什么技术过时了可以直接用新技术的
android·过时技术
lingggggaaaa5 小时前
PHP原生开发篇&文件安全&上传监控&功能定位&关键搜索&1day挖掘
android·学习·安全·web安全·php
我是场6 小时前
我的NPI项目 - OTA upgrade是什么?
android·人工智能
zh_xuan6 小时前
Android 实现fragment导航
android·fragment导航
java资料站6 小时前
MySQL 增量同步脚本
android·数据库·mysql
穷人小水滴6 小时前
手机安装 Cross Profile Test App (Android)
android·手机·一加
zh_xuan6 小时前
Android Paging 3实现分页加载
android·git·github·paging 3