I found this most excellent solution to the exact issue I am trying to solve here:
Blur or dim background when Android PopupWindow active
However, I cannot get the parent view to dim by setting the Alpha. I am using a rectangle shape as the solution suggests The Drawable is a GradientDrawable. Here's the code I'm using:
@Override
public void onViewPhoto(PostObject item) {
rootView.getForeground().setAlpha(220);
rootView.invalidate();
PhotoPopup pp = new PhotoPopup(getActivity(), rootView, item.getObject_Id());
pp.show();
rootView.getForeground().setAlpha(0);
rootView.invalidate();
}
The code above is in the parent fragment that will host the popup. It's called via a custom callback. The call is made by an ArrayAdapter derived adapter when the user clicks on a photo in the listview item.
I've tried this on both KitKat (Asus Memo Pad) and JellyBean (Samsung Galaxy Tab 2) Any ideas?
For completeness: Here's the Layout
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/streamList_rootFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="@drawable/shape_dim_window" >
<ListView
android:id="@+id/streamList_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</FrameLayout>
And the shape itself:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#000000" />
</shape>