Android PopupWindow 問題。
問題描述
需求是點擊popupwindow 外部,popupwindow不消失。目前 Android 6.0 以下的系統(tǒng)均沒問題,但是6.0的系統(tǒng)上面點擊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. MySQL的聯(lián)合查詢[union]有什么實際的用處2. 怎么能做出標(biāo)簽切換頁的效果,(文字內(nèi)容隨動)3. mysql - sql 左連接結(jié)果union右連接結(jié)果,導(dǎo)致重復(fù)性計算怎么解決?4. 從git上下載的laravel項目不能用5. 數(shù)組排序,并把排序后的值存入到新數(shù)組中6. php多任務(wù)倒計時求助7. mysql 遠(yuǎn)程連接出錯10060,我已經(jīng)設(shè)置了任意主機了。。。8. mysql怎么表示兩個字段的差9. PHP訂單派單系統(tǒng)10. 默認(rèn)輸出類型為json,如何輸出html
