I am working with Android Support package.
I have created a dialog:
Dialog dialog = new Dialog(activity, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
Since I would like the dialog show in a full screen, so I applied the theme Theme_Translucent_NoTitleBar_Fullscreen
to it & it works.
I have following two questions:
I would like my dialog to show like full screen still but leave the top ActionBar not be covered by it, what Theme should I use then?
How to have an gray color overlay to also show the view covered by the dialog (assume my 1st qustion has resolved)?
- The only working solution I found is to implement pseudo-dialog based on fragment.
- This approach might cause some difficulties to do shadow. At least, I didn't do that.
Code sample how to do (1):
public class MyDialog extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// ... your code
}
public void show(FragmentManager fragmentManager) {
FragmentTransaction ft = fragmentManager.beginTransaction();
String tag = MyDialog.class.getName();
ft.add(android.R.id.content, this, tag);
ft.commit();
}
private void dismiss() {
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.remove(this);
ft.commit();
}
}