Android PopupWindow 問題。
問題描述
需求是點擊popupwindow 外部,popupwindow不消失。目前 Android 6.0 以下的系統均沒問題,但是6.0的系統上面點擊popupwindow外部以后popupwindow 消失。哪位大佬知道的說下哦。
同時一并問下6.0系統中使用 ContextCompat.checkSelfPermission 同時檢查 讀,寫聯系人權限如何實現?
問題解答
回答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:
檢查權限:讀權限:ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED;寫權限:ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_CONTACTS) == PackageManager.PERMISSION_GRANTED;判斷時添加&&用于判斷兩個條件是否return true請求權限:第一步:String[] permissions = {Manifest.permission.READ_CONTACTS,Manifest.permission.WRITE_CONTACTS}第二步:ActivityCompat.requestPermissions(activity, permissions,requestCode);
相關文章:
1. javascript - 移動端自適應2. datetime - Python如何獲取當前時間3. atom開始輸入!然后按tab只有空格出現沒有html格式出現4. javascript - 在 model里定義的 引用表模型時,model為undefined。5. css3 - 這個右下角折角用css怎么畫出來?6. apache - 想把之前寫的單機版 windows 軟件改成網絡版,讓每個用戶可以注冊并登錄。類似 qq 的登陸,怎么架設服務器呢?7. android - 課程表點擊后浮動后邊透明可以左右滑動的界面是什么?8. python3.x - c++調用python39. css3 - 沒明白盒子的height隨width的變化這段css是怎樣實現的?10. java - 根據月份查詢多個表里的內容怎么實現好?
