I am new to Android Studio. I am trying to create a Popup window to collect user information. However I keep getting some sort of a toolbar with the name of the project in my Popup window. How do I remove that?

I created a separate Popup class and a separate layout resource file with xml.

Here is the code for the Popup class:

    @Override protected void onCreate(Bundle savedInstanceState) {
        DisplayMetrics temp = new DisplayMetrics();
        getWindow().setLayout(temp.widthPixels, (int)(temp.heightPixels*0.25));

Here is the code for the xml file:

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

I am expecting to see a white popup window with no toolbar or anything of that sort.

2 Answers

Ahmad Sattout On

What popup window do you mean? If you're talking about the AlertDialog or Dialog, request the NO_TITLE feature from the window manager.

Triyambak Gupta On

Inside your Resource/Values/Style create a custom theme like:

<style name="XYZ" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@color/abc</item>

And in your manifest file use this custom style theme as: