Android PopupWindow 問題。
問題描述
需求是點(diǎn)擊popupwindow 外部,popupwindow不消失。目前 Android 6.0 以下的系統(tǒng)均沒問題,但是6.0的系統(tǒng)上面點(diǎn)擊popupwindow外部以后popupwindow 消失。哪位大佬知道的說下哦。
同時一并問下6.0系統(tǒng)中使用 ContextCompat.checkSelfPermission 同時檢查 讀,寫聯(lián)系人權(quán)限如何實現(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;判斷時添加&&用于判斷兩個條件是否return true請求權(quán)限:第一步:String[] permissions = {Manifest.permission.READ_CONTACTS,Manifest.permission.WRITE_CONTACTS}第二步:ActivityCompat.requestPermissions(activity, permissions,requestCode);
相關(guān)文章:
1. html - vue項目中用到了elementUI問題2. java - 如何寫一個intellij-idea插件,實現(xiàn)編譯時修改源代碼的目的3. javascript - 有什么比較好的網(wǎng)頁版shell前端組件?4. javascript - 如何將一個div始終固定在某個位置;無論屏幕和分辨率怎么變化;div位置始終不變5. javascript - 求解答:實例對象調(diào)用constructor,此時constructor內(nèi)的this的指向?6. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風(fēng)格檢查怎么辦。。。7. html5 - 有可以一次性把所有 css外部樣式轉(zhuǎn)為html標(biāo)簽內(nèi)style=" "的方法嗎?8. javascript - [js]為什么畫布里不出現(xiàn)圖片呢?在線等9. java 中Long 類型如何轉(zhuǎn)換成Double?10. javascript - 原生canvas中如何獲取到觸摸事件的canvas內(nèi)坐標(biāo)?
