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

  • SEARCH
  • Home
  • 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 6775219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:52:51+00:00 2026-05-26T15:52:51+00:00

I have created a custom dialog, the code is below. The problem is that,

  • 0

I have created a custom dialog, the code is below. The problem is that, the height of the dialog is becoming wrap_content, i.e it is independent of what ever the height i mention in the xml. I have checked other questions, they din’t help me.

public class PointsDialogFragment extends DialogFragment{

    private static final String TAG = PointsDialogFragment.class.getSimpleName();

    public static PointsDialogFragment newInstance(){
        PointsDialogFragment pdf = new PointsDialogFragment();
        Bundle newBundle = new Bundle();
        pdf.setArguments(newBundle);
        return pdf;
    }

    private View mRoot;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        getDialog().requestWindowFeature(STYLE_NO_TITLE);
        mRoot = inflater.inflate(R.layout.fragment_points_dialog, null);
        return mRoot;
    }
}

and the xml for fragment_points_dialog.xml is

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="313dp"
    android:layout_width="fill_parent"
    android:background="@color/green_gradient_start"
>
    <RelativeLayout 
        android:layout_width="173dp"
        android:layout_height="242dp"
        android:background="@drawable/reward_box"
        android:id="@+id/reward_box"
        android:layout_alignParentLeft="true"
    >
        <TextView 
            android:layout_centerInParent="true"
            style="@style/WallSectionHeading"
            android:text="5"
        />
    </RelativeLayout>
    <RelativeLayout 
        android:layout_width="173dp"
        android:layout_height="250dp"
        android:background="@drawable/reward_mascot"
        android:layout_alignParentRight="true"
    >
        <LinearLayout
            android:id="@+id/reward_cloud"
            android:layout_width="wrap_content"
            android:layout_height="100dp"
            android:background="@drawable/reward_cloud"
            android:layout_alignParentBottom="true"
        >
            <TextView
                android:layout_gravity="center_vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="You have gained 5 Delight Points"
                android:textColor="@color/white"
                android:textStyle="italic"
                android:paddingLeft="15dp"
                android:paddingRight="10dp"
            />
        </LinearLayout>

    </RelativeLayout>

</RelativeLayout>

I am showing dialog like this..

PointsDialogFragment pdf = PointsDialogFragment.newInstance();
pdf.show(getFragmentManager(), "dialog");

I would like know a way i can change the height of the dialog with in the dialog fragment.

  • 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-05-26T15:52:52+00:00Added an answer on May 26, 2026 at 3:52 pm

    I think the problem is that when you inflate the View, you’re not supplying the ViewParent. When you don’t supply that parameter, any “layout_X” parameters in the root of your View will be ignored, as those values are supplied to the parent (which is null in your current situation). What you can do is either supply a ViewParent when inflating or wrap your View XML in another ViewGroup, leaving the absolute layout parameters in the 2nd level.

    Sample code:
    mRoot = inflater.inflate(R.layout.fragment_points_dialog, container, false);

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

Sidebar

Related Questions

friends, i have created custom title bar using following titlebar.xml file with code <?xml
I have created a custom dialog and a layout xml: <?xml version=1.0 encoding=utf-8?> <LinearLayout
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a custom workflow activity that copies attachments from a case to
I have created a custom tag that looks like this: def textField = {
I have a conceptual question to ask: I created a custom dialog (extends Dialog)
i have this code that should create a dialog with the page google inside
I have created a custom dialog box which requires 3 fields public class Test{
I have created a My custom Dialog which extends org.eclipse.jface.dialogs.Dialog. But whenever it displays,
I have a code for jqGrid with custom editFunc that opens my own jQuery-UI

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.