2017-03-03 76 views
0

我有一个相机应用程序,运行全屏,因为在没有顶栏和没有android控制按钮。在这个屏幕上我还显示了一个包含一堆选项的对话框,问题是一旦对话框出现顶栏并且按钮显示出来。我发布了一个截图。全屏对话框

我试着用

alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 

但没有奏效。

enter image description here

回答

0

您是否使用了DialogFragment?将以下行添加到其onCreate()为我解决了这个问题。

this.getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
+0

有了这个我没有得到任何标题,但后面,主页按钮仍然存在:( – MichelReap

0

尝试使用下面的一行代码:

alertdialog.getWindow().setFlags(LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FULLSCREEN); 
1

另一个解决方法是给全屏幕主题对话。

<style name="full_screen_dialog"> 
    <item name="android:windowFrame">@null</item> 
    <item name="android:windowIsFloating">true</item> 
    <item name="android:windowContentOverlay">@null</item> 
</style> 

和初始化你喜欢对话

Dialog kek = new Dialog(Product_List_View_All.this,R.style.full_screen_dialog); 

我希望这将有助于

1

试试这个代码:我的作品..

mDialog = new Dialog(this, 
      android.R.style.Theme_Translucent_NoTitleBar); 
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 

    mDialog.getWindow().setBackgroundDrawable(
      new ColorDrawable(android.graphics.Color.TRANSPARENT)); 
    mDialog.setContentView(R.layout.your_dialog_layout); 
在styles.xml

<style name="Theme.Translucent.NoTitleBar"> 
    <item name="windowNoTitle">true</item> 
    <item name="windowContentOverlay">@null</item> 
</style>