Android PopupWindow 問題。
問題描述
需求是點(diǎn)擊popupwindow 外部,popupwindow不消失。目前 Android 6.0 以下的系統(tǒng)均沒問題,但是6.0的系統(tǒng)上面點(diǎn)擊popupwindow外部以后popupwindow 消失。哪位大佬知道的說下哦。
同時(shí)一并問下6.0系統(tǒng)中使用 ContextCompat.checkSelfPermission 同時(shí)檢查 讀,寫聯(lián)系人權(quán)限如何實(shí)現(xiàn)?
問題解答
回答1:popupWindow.setFocusable(false);popupWindow.setTouchable(true);popupWindow.setBackgroundDrawable(new BitmapDrawable());popupWindow.setOutsideTouchable(false);popupWindow.update();
我試了下,貌似有效果
回答2:When window touchable is true, focusable is false,setOutsideTouchable() works.
pw.setTouchable(true); pw.setFocusable(false); pw.setOutsideTouchable(false);記得給我加分哦!!!thx!回答3:
檢查權(quán)限:讀權(quán)限:ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED;寫權(quán)限:ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_CONTACTS) == PackageManager.PERMISSION_GRANTED;判斷時(shí)添加&&用于判斷兩個(gè)條件是否return true請(qǐng)求權(quán)限:第一步:String[] permissions = {Manifest.permission.READ_CONTACTS,Manifest.permission.WRITE_CONTACTS}第二步:ActivityCompat.requestPermissions(activity, permissions,requestCode);
相關(guān)文章:
1. linux - 編譯時(shí)提示頭文件#include <mysql/mysql.h>不存在,百度之后也沒解決2. python - openpyxl讀取xlsx文件把數(shù)據(jù)生成字典,中文編碼問題?3. node.js - mac下vue-cli構(gòu)建的項(xiàng)目為啥在windows就報(bào)錯(cuò)呢?4. python - beautifulsoup獲取網(wǎng)頁內(nèi)容的問題5. mysql主從復(fù)制 REPLICATE_DO_DB 參數(shù)從服務(wù)器reboot后每次都回滾為初始設(shè)置6. mysql索引 - mysql的表如何重新組織(或生成)索引?7. python小白的基礎(chǔ)問題 關(guān)于while循環(huán)的嵌套8. 設(shè)置 mysql 的 root用戶 可以被外網(wǎng)訪問后的問題9. django - Python error: [Errno 99] Cannot assign requested address10. python - linux怎么在每天的凌晨2點(diǎn)執(zhí)行一次這個(gè)log.py文件
