Dim Window when Menu opened in Android

Posted by Casebash on Stack Overflow See other posts from Stack Overflow or by Casebash
Published on 2010-05-03T04:22:13Z Indexed on 2010/05/03 4:28 UTC
Read the original article Hit count: 290

Filed under:

In Android, when an alert appears, the background is dimmed. I would like a similar effect for when the menu is opened. I tried the following code, but it didn't work:

@Override
public boolean onMenuOpened(int featureId, Menu m) {
    boolean ret=super.onMenuOpened(featureId,m);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    return ret;
}

Does anyone know how to achieve this?

© Stack Overflow or respective owner

Related posts about android