How to show the image outside the dialog in android?

Viewed 1403

I trying to show the profile image in topside of the dialog fragment with half outside the image.and i attach the sample dialog in below, like that.And tried all FrameLayout collaboration from old Stackoverflow solutions, But i cant able to archive this. Please give me correct solution. Thankyou.

enter image description here

Updated I also tried to make transparent the ImageView parent layout but it's not working in after dialog show. i attach my xml and result screen shot below.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_item"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<RelativeLayout
    android:id="@+id/imageshow"
    android:layout_width="match_parent"
    android:layout_height="100dp">

    <View
        android:id="@+id/imagePadding"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="@android:color/transparent" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/imagePadding"
        android:background="#ff0000"></LinearLayout>

    <ImageView
        android:id="@+id/info_profile"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerHorizontal="true"
        android:src="@drawable/technician_pitcher" />
</RelativeLayout>

enter image description here

3 Answers

This could be the simplest anwer?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rl_alert_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="20dp"
    android:background="#00FFFFFF">

    <TextView
        android:id="@+id/alert_textview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="48dp"
        android:background="#FFF"
        android:paddingHorizontal="20dp"
        android:paddingTop="50dp"
        android:paddingBottom="20dp"
        android:text="Your text goes here.." />

    <ImageView
        android:id="@+id/alert_icon"
        android:layout_width="96dp"
        android:layout_height="96dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/ic_alert_bell" />
</RelativeLayout>
Related