Q:

rounded corners in FragmentDialog

Iknow ths question people asked billin times but no one sulotion what I find doesnt help me.I have shape like this

<solid 
     android:color="#FFFFFF"/>

    <stroke
        android:width="2dp"
        android:color="#FFFFFF"/>
    <corners android:radius="30dp" />
</shape>

add this to my main RelativeLayout, my layout file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <Button
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:background="@drawable/ic_clear_black_18dp"
        />
    <ImageView
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_centerHorizontal="true"
        android:id="@+id/dialog_icon"
        android:src="@drawable/emilypic"
        android:background="@drawable/cicon"
        />
<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:id="@+id/LLTitleandNick"
android:layout_below="@id/dialog_icon"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    >
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/dialog_title"
        android:textSize="22sp"
        android:textColor="@color/title_color"
        android:text="Lily Martinson"
        />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/dialog_nickname"
        android:textSize="18sp"
        android:text="lilmartini"
        android:layout_marginLeft="35dp"
    />
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_below="@id/LLTitleandNick"
android:layout_marginTop="30dp"
        android:id="@+id/LLFollowers"
        >
        <ImageView
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:id="@+id/image_like"
            android:layout_marginLeft="30dp"
            android:src="@drawable/ic_favorite_border_black_18dp"
            />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/Followers"
            android:text="Followers"
            />
<ImageView
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:id="@+id/image_follow"
    android:layout_marginLeft="80dp"
    android:src="@drawable/ic_directions_walk_black_18dp"
    />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Following"

            />
        </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/LLwithButtons"
        android:layout_below="@+id/LLFollowers"
        android:layout_marginTop="70dp"
        >
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:background="@drawable/ic_question_answer_black_36dp"

            />
        <Button
            android:layout_width="60dp"
            android:layout_height="50dp"
            android:background="@drawable/cicon"

            android:layout_marginLeft="35dp"
            />
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
android:background="@drawable/ic_person_add_black_36dp"
            android:layout_marginLeft="40dp"
            />

    </LinearLayout>
</RelativeLayout>

but problem is that I need dialog for some size,my layout build this dialog but when I add shape,shape is for all screen,all elements change they position and nothing good for me.I tryed to change RelativeLayout(my main layout) size but shape still show for all screen.How can I change this?I was try to add theme like(Transculent,sorry for maybe mistake) and some else but nothing doesnt help me.

A:

/** Go to Drawable folder just make the rounded_corner.xml and paste the below code ,CAREFULLY check out this xml is created or not in your drawable folder **/ 
<?xml version="1.0" encoding="UTF-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android">
    <stroke
        android:width="1dp"
        android:color="#4D4D4D"/>

    <corners
        android:radius="7dp" />

    <padding
        android:left="1dp"
        android:right="1dp"
        android:top="1dp"
        android:bottom="1dp"/>

    <solid android:color="#FFF"/>

</shape>

/** Now go to your layout.xml copy and paste this code **/
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@drawable/rounded_corner">
<Button
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/ic_clear_black_18dp"
    />
<ImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_centerHorizontal="true"
android:id="@+id/dialog_icon"
android:src="@drawable/emilypic"
android:background="@drawable/cicon"
    />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/LLTitleandNick"
android:layout_below="@id/dialog_icon"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
    >
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/dialog_title"
    android:textSize="22sp"
    android:textColor="@color/title_color"
    android:text="Lily Martinson"
    />
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/dialog_nickname"
    android:textSize="18sp"
    android:text="lilmartini"
    android:layout_marginLeft="35dp"
    />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/LLTitleandNick"
android:layout_marginTop="30dp"
android:id="@+id/LLFollowers"
    >
<ImageView
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:id="@+id/image_like"
    android:layout_marginLeft="30dp"
    android:src="@drawable/ic_favorite_border_black_18dp"
    />
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/Followers"
    android:text="Followers"
    />
<ImageView
    android:layout_width="20dp"
    android:layout_height="20dp"
    android:id="@+id/image_follow"
    android:layout_marginLeft="80dp"
    android:src="@drawable/ic_directions_walk_black_18dp"
    />
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Following"

    />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/LLwithButtons"
android:layout_below="@+id/LLFollowers"
android:layout_marginTop="70dp"
    >
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:background="@drawable/ic_question_answer_black_36dp"

    />
<Button
    android:layout_width="60dp"
    android:layout_height="50dp"
    android:background="@drawable/cicon"

    android:layout_marginLeft="35dp"
    />
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/ic_person_add_black_36dp"
    android:layout_marginLeft="40dp"
    />
</LinearLayout> </RelativeLayout>

