English 中文(简体)
完全检查的习俗诊断
原标题:Custom Dialog in full screen?

Is there any way to make my Dialog view full screen, i.e dialog occupy the entire screen (like an Activity). I tried using the LayoutParams and styles like <item name="android:windowFullscreen">true</item> but nothing seems to be working.

I found a way of getting rid of the Title bar, but couldn t find a way to put a dialog in full screen. So can any one suggest me a way to do it.

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="@android:style/Theme.Dialog">
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowFrame">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowBackground">@color/dialog_background</item>
</style>
</resources>
最佳回答

Give its constructor a non-dialog theme, such as android.R.style.Theme or android.R.style.Theme_Light.

Code by @Bob.

Dialog dialog = new Dialog(context, android.R.style.Theme_Light); 
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
dialog.setContentView(R.layout.MyCustomDialogLayout); 
dialog.show();
问题回答

在我的案件中遵循法典:

dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
dialog.setContentView(R.layout.mydialog2);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);

Try this

dialog = new Dialog(context,android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);

1. cus你的方言风格

 <style name = "MyDialog" >
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name = "android:windowContentOverlay" >@null</item >
        <item name = "android:colorBackgroundCacheHint" >@null</item >
        <item name = "android:backgroundDimEnabled">true</item>
        <item name = "android:windowBackground" >@android:color/transparent</item >
    </style >

2 :cus

WindowManager wm = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
            int width = wm.getDefaultDisplay().getWidth();
            int height = wm.getDefaultDisplay().getHeight();
            final Dialog dialog = new Dialog(this, R.style.MyDialog);
            View view = LayoutInflater.from(this).inflate(R.layout.layout_dialog, null);

            WindowManager.LayoutParams params = dialog.getWindow().getAttributes();
            params.width = WindowManager.LayoutParams.MATCH_PARENT;
            params.height = WindowManager.LayoutParams.WRAP_CONTENT;

            dialog.setContentView(view);
            dialog.getWindow().setGravity(Gravity.BOTTOM);
            dialog.getWindow().setWindowAnimations(R.style.mydialog_Style);
            dialog.show();

答案不是为我(sdk 21, samsung galaxy s5)。 在搜索和测试之后,我发现,确定全屏幕的方位的关键点是:<代码><item name=“android:windowIsFloating”>false</item>。 血清中的多数风格使它成为现实! 把它 false作假,用它来做

AlertDialog.Builder = new AlertDialog.Builder(getActivity(), R.style.YourStyle);

您的风格可能好像

<style name="YourStyle">
    <item name="android:windowIsFloating">false</item>
    ...
</style>

在作出虚假陈述之后,应当进行充分的筛选。 此外,你也可以使用

dialog.getWindow.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);

to set it s height to wrap_content. Hope to help someone.

电话:dialog_custom_layout.xml into RelativeLayout。 这为我工作。

如欲填满的方言,请将<>条码>-DialogFragment延伸至<0>。

When you create dialog instance just use android.R.style.Theme_Black_NoTitleBar_Fullscreen theme with context like this :

Dialog dialog = new Dialog(getActivity(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);

AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);

这将在完全屏幕上显示方言。

尝试这项法典

protected void openDialog() {
        Dialog dialog = new Dialog(this);
        dialog.addContentView(new View(this), (new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)));
        dialog.show();
    }

I m使用与Dialog主题相关的活动。 在此情况下,全面筛选就是这样:

int mUIFlag = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

        getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
        setContentView(R.layout.lockscreen_activity);
}

创建你的习俗诊断

Dialog dialog = new Dialog(context, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);

这里的步骤是,如何在不从每个地点穿过任何dding子的情况下,用常规布局进行全面的诊断。

<>Step 1: 界定你的习惯方言布局,名称为layout_full Screen_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorPrimary">

    <!-- Your dialog content here -->

</LinearLayout>

http://www.ohchr.org。 在<代码>上界定新风格:xml,名称为FullScreenDial

<style name="FullScreenDialog" parent="Theme.AppCompat.Dialog">
    <item name="android:windowBackground">@android:color/transparent</item>
</style>

<>3>标准: 一种生成和显示方言的方法

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        createAndShowDialog(this);
    }

    // This method used to create and show a full screen dialog with custom layout.
    public void createAndShowDialog(Context context) {
        Dialog dialog = new Dialog(context, R.style.FullScreenDialog);
        dialog.setContentView(R.layout.layout_fullscreen_dialog);

        WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
        dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
        dialog.getWindow().setAttributes(layoutParams);
        dialog.show();
    }
}

www.un.org/spanish/ecosoc 带有数据约束力的全面筛查诊断

    fun showUserQrCode(
    mContext: Activity,
    showAddMore: Boolean,
    message: String?,
    skipClick: View.OnClickListener?,
    addMoreClick: View.OnClickListener?
) {

    val dialog = Dialog(mContext, android.R.style.Theme_Black_NoTitleBar_Fullscreen)
    val discountBinding: PopupUserQrCodeBinding = DataBindingUtil.inflate(
        LayoutInflater.from(mContext),
        R.layout.popup_user_qr_code,
        null,
        false
    )
    discountBinding.btnSkip.setOnClickListener(skipClick)


    dialog.setContentView(discountBinding.root)
    dialog.show()
}

<>光临>

    val dialog = Dialog(mContext, android.R.style.Theme_Black_NoTitleBar_Fullscreen)
    dialog.setContentView(R.layout.slider_layout)
    dialog.show()

类似:

Dialog dialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
dialog.setContentView(R.layout.my_content);
dialog.show();

Basically uses a non-dialog theme for dialog.
Path in styles.xml would be: @android:style/Theme.Translucent.NoTitleBar.Fullscreen

科特林

val dialog = Dialog(this, android.R.style.Theme_Light)
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
        dialog.setContentView(R.layout.level_complete)
        dialog.show()
        dialog.setCancelable(false)




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签