Android dialog height and widh is behaving unexpectedly



HI i have custom dialog now when i run the code it behaving unexpectedly. It shrinks it's height and width . The xml of custom dialog is added below



<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#143849"
android:orientation="vertical" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="30dp"
android:src="@drawable/plainwhite" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="10" >

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="center" >

<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/plainwhite" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="7"
android:orientation="vertical" >

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="FLIGHT DETAILS" />

<TextView
android:id="@+id/placeTravel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Kannur - Trivandrum" />

<TextView
android:id="@+id/dateOfTravel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="wed, dec-10 " />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:weightSum="10" >

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="Depart" />

<TextView
android:id="@+id/departTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:hint=":Kannur" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="10" >

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="Arrive" />

<TextView
android:id="@+id/arriveTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:hint=":Trivandrum" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="10" >

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="Duration" />

<TextView
android:id="@+id/durationTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:hint=":02h 15m nonstop" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="10" >

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="Price" />

<TextView
android:id="@+id/travelPriceTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:hint=":$450 per Adult" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="10" >

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4" />

<TextView
android:id="@+id/planType"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:hint="(Non refundable)" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

</LinearLayout>


And the code calling the dialog is added below



Dialog dialog = new Dialog(context, R.style.customDialogStyle);
dialog.setContentView(R.layout.flight_info_dialog);


what I am getting is shown below


enter image description here


Any help will be appreciable


No comments:

Post a Comment