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.
What popup window do you mean? If you're talking about the AlertDialog or Dialog, request the NO_TITLE feature from the window manager.
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.