Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9184645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:06:17+00:00 2026-06-17T19:06:17+00:00

I am trying to get a popup to behave! =) The problem is that

  • 0

I am trying to get a popup to behave! =)

The problem is that the popup “fills the width” of the entire screen, even though the layout clearly says that it should “wrap_content”. It doesnt matter if I use Dialog or PopupWindow.

First, the XML layout of the popup, popup_message.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_margin="20dp"
    android:background="@android:color/transparent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:orientation="horizontal"
        android:layout_gravity="center" >

        <TextView
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:layout_gravity="center"
            android:background="@android:color/transparent"
            android:gravity="center_vertical|center_horizontal"
            android:orientation="horizontal"
            android:paddingLeft="10dp"
            android:text="@string/new_message"
            android:textColor="#000000"
            android:textAllCaps="true" >

        </TextView>
    </LinearLayout>

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="15dp"
        android:background="#ffffff"
        android:gravity="center_horizontal"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/popup_message_textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textCursorDrawable="@null" >
        </TextView>

        <Button
            android:id="@+id/jobview_pickup_start_submit"
            android:layout_width="fill_parent"
            android:layout_height="35dp"
            android:layout_below="@+id/popup_message_textView"
            android:layout_gravity="center_vertical|center_horizontal"
            android:layout_marginBottom="15dp"
            android:layout_marginTop="15dp"
            android:gravity="center_horizontal"
            android:text="Confirm"
            android:textColor="#000000" />
    </RelativeLayout>
</LinearLayout>

And the code I am using:

LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View input = inflater.inflate(R.layout.popup_message, null);
PopupWindow pw = new PopupWindow(input, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
View v = findViewById(R.id.main_deviceInfoBar);
pw.showAtLocation(v, Gravity.CENTER, 0, 0);

I have also tried this:

Dialog dialogManualStart = new Dialog(MainActivity.this);
dialogManualStart.getWindow().setBackgroundDrawableResource(R.color.transparent);
dialogManualStart.requestWindowFeature(MainActivity.this.getWindow().FEATURE_NO_TITLE);
dialogManualStart.setContentView(input);
dialogManualStart.show();

And it always, no matter what code I use, looks like this:

enter image description here

As you can see, its always filling the width of the screen.

Question: Can anyone tell me why?

======== EDIT 1 =============

I changed the Button to “wrap_content” (according to Boogers suggestion), and then it looks like this:

enter image description here

This is very strange behaviour, not what I expected.

If I change it to “match_parent”, its back to “full width”, ie it extends all the way from left to right.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:06:18+00:00Added an answer on June 17, 2026 at 7:06 pm

    This is your problem:

    <Button
                android:id="@+id/jobview_pickup_start_submit"
                android:layout_width="fill_parent"
    ...
    

    Change that from “fill_parent” to “wrap_content” or “match_parent”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to jquery. I'm trying to get an alert box to popup with
So I'm trying to get a popup box to show when a user rates
Trying to get Facebook to authenticate my users via a javascript popup. Right now,
Im trying to get a CDialog that has no border or frame to show
I am trying to get a popup appear the first time an app is
I am trying to get a modal popup to work, it needs to be
I am trying to get a webview into a popup dialog. I can get
I'm trying to get my application to display a popup context menu when a
I am trying get Javascript popup calendar control to work which doesnt work. I
i'm trying to get the following example set up on my computer: http://deluxe-menu.com/popup-mode-sample.html I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.