您的位置:首頁技術文章
文章詳情頁

Android PopupWindow 問題。

瀏覽:96日期:2024-08-27 17:04:50

問題描述

需求是點擊popupwindow 外部,popupwindow不消失。目前 Android 6.0 以下的系統均沒問題,但是6.0的系統上面點擊popupwindow外部以后popupwindow 消失。哪位大佬知道的說下哦。

同時一并問下6.0系統中使用 ContextCompat.checkSelfPermission 同時檢查 讀,寫聯系人權限如何實現?

Android PopupWindow 問題。

Android PopupWindow 問題。

問題解答

回答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);記得給我加分哦!?。hx!回答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);

相關文章:
国产综合久久一区二区三区