BitmapDrawable已弃用,我正在尝试将此代码替换为更新的代码。有人可以建议更新的代码和示例吗?
/**
* On pre show
*/
protected void preShow() {
if (mRootView == null)
throw new IllegalStateException("setContentView was not called with a view to display.");
onShow();
if (mBackground == null)
mWindow.setBackgroundDrawable(new BitmapDrawable());
else
mWindow.setBackgroundDrawable(mBackground);
mWindow.setWidth(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setHeight(WindowManager.LayoutParams.WRAP_CONTENT);
mWindow.setTouchable(true);
mWindow.setFocusable(true);
mWindow.setOutsideTouchable(true);
mWindow.setContentView(mRootView);
}
答案 0 :(得分:1)
我也在使用这个库,我将其更改为以下内容,一切正常:
mWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
注意:我也试过mWindow.setBackgroundDrawable(null)
,但它以某种方式杀死了onTouch
听众。