Skip to content

Commit

Permalink
修复Android 8.0系统画中画崩溃问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Doikki committed Jul 5, 2018
1 parent b4b5817 commit 631a131
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/main/java/com/dueeeke/dkplayer/widget/FloatView.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ private void init() {
private void initWindow() {
mWindowManager = WindowUtil.getWindowManager(getContext().getApplicationContext());
mParams = new WindowManager.LayoutParams();
mParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; // 设置window type
// mParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT; // 设置window type
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
mParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
}else {
mParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
}
// 设置图片格式,效果为背景透明
mParams.format = PixelFormat.TRANSLUCENT;
mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
Expand Down

0 comments on commit 631a131

Please sign in to comment.