I'm trying to create a Custom Dialog
like this, I'm following this answer but changing the layout_gravity
to this android:layout_gravity="center_horizontal|top"
and it puts on the center of the Dialog
as I want, but the thing is that if I want to put the ImageView
bigger it destroys the xml
, also the Dialog
itself it's too small because I only have a TextView
and an EditText
so what I'm doing wrong?
This is my xml.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="15dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#fff"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Choose the receiver"
android:textColor="@color/blue"
android:textSize="16dp" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/edittext_style"
android:hint="Username"
android:padding="5dp"
android:singleLine="true"
android:textColorHint="@color/wallet_holo_blue_light" />
</LinearLayout>
</FrameLayout>
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_horizontal|top"
android:src="@drawable/icon_mail" />
</FrameLayout>
</FrameLayout>
OUTPUT
Also I've a Drawable
to put it on the Dialog
to create a border roundered with color and if I put it on LinearLayout
it doesn't show up.
This is the rounded_border.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="@color/white" />
<corners android:radius="12dip" />
<stroke
android:width="1dip"
android:color="@color/wallet_holo_blue_light" />
</shape>
</item>
If I change the size of the ImageView
happens this :