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) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.update);
        DisplayMetrics temp = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(temp);
        getWindow().setLayout(temp.widthPixels, (int)(temp.heightPixels*0.25));
    }
```}

Here is the code for the xml file:

```xmlCode
<?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">
</RelativeLayout>

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

2 Answers

0
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.

0
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>
</style>

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

<activity
    android:name=".MyActivity"
    android:theme="@style/XYZ">   
</activity>