Question:
How to call something dialog without ActionBar
so that only the layout
file is displayed. Hiding/killing the ActionBar
/changing the theme of the Activity
“DialogFragment“ (if possible) would also work.
Attempts I've tried but didn't work:
- Make an
Activity
with@android:style/Theme.Dialog.NoTitleBar
and@android:style/Theme.NoTitleBar.Dialog
. - Make an
Activity
with@android:style/Theme.Dialog.NoTitleBar
and@android:style/Theme.NoTitleBar.Dialog
. MakeDialogFragment
, and then remove, hideActionBar
– it turns out that theDialogFragment
does not have anActionBar
(at leastgetActionBar
does not work). - Make your
style
withDialog
andNoTitleBar
. It didn't work out at all.
Help me please!
Answer:
Here is one of the solutions to your problem:
-
If you are using
Dialog
:Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.my_dialog_la); dialog.show();
-
If you are extending
DialogFragment
, then add the following line toonCreate
:setStyle(STYLE_NO_TITLE, 0);