0

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.

Zoe
  • 27,060
  • 21
  • 118
  • 148
Atiqul Islam
  • 83
  • 1
  • 1
  • 4

2 Answers2

0

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

Ahmad Sattout
  • 2,248
  • 1
  • 19
  • 42
0

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>
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574