1

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);
}
4

1 回答 1

1

我也在使用这个库,并将其更改为以下,一切正常:

mWindow.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

注意:我也试过mWindow.setBackgroundDrawable(null)了,但它以某种方式杀死了onTouch听众。

于 2013-07-24T14:21:25.530 回答