1

Required output image:

enter image description here

I have tried the code and my output is like this. Kindly help me to produce the output as I have shown.

My code:

In Activity:

@OnClick(R.id.imageView)
    void imageTapped() {
        Dialog alertDialog = new Dialog(this);
        alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        alertDialog.setContentView(R.layout.photo_dialog);
        alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        alertDialog.show();
    }

In XML (R.layout.photo_dialog):

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tabLayout"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:gravity="bottom"
    android:background="@android:color/transparent">


    <Button
        android:id="@+id/btn1"
        android:layout_width="@dimen/_200sdp"
        android:layout_height="wrap_content"
        android:background="#3ca49c"
        android:paddingBottom="@dimen/activity_margin_half"
        android:paddingLeft="@dimen/_40sdp"
        android:paddingRight="@dimen/_40sdp"
        android:paddingTop="@dimen/activity_margin_half"
        android:text="Take Photo"
        android:layout_marginBottom="@dimen/_20sdp"
        android:layout_centerHorizontal="true"
        android:textColor="@color/white"/>

    <Button
        android:id="@+id/btn2"
        android:layout_width="@dimen/_200sdp"
        android:layout_height="wrap_content"
        android:background="#3ca49c"
        android:paddingBottom="@dimen/activity_margin_half"
        android:paddingLeft="@dimen/_40sdp"
        android:paddingRight="@dimen/_40sdp"
        android:paddingTop="@dimen/activity_margin_half"
        android:text="Choose Existing"
        android:layout_below="@id/btn1"
        android:layout_marginBottom="@dimen/_20sdp"
        android:layout_centerHorizontal="true"
        android:textColor="@color/white"/>

    <Button
        android:id="@+id/btn3"
        android:layout_width="@dimen/_200sdp"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:paddingBottom="@dimen/activity_margin_half"
        android:paddingLeft="@dimen/_40sdp"
        android:paddingRight="@dimen/_40sdp"
        android:layout_below="@id/btn2"
        android:layout_marginBottom="@dimen/_40sdp"
        android:paddingTop="@dimen/activity_margin_half"
        android:text="Cancel"
        android:layout_centerHorizontal="true"
        android:textColor="#3ca49c"/>

</RelativeLayout>

My output:

enter image description here

I need a white transparent background and the alignments as shown in the required output image. Kindly help me with some suggestions.

dda
  • 6,030
  • 2
  • 25
  • 34

1 Answers1

2

Try this :

Use color code for white transperent : #B3ffffff

Dialog alertDialog = new Dialog(this);
        alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        alertDialog.setContentView(R.layout.photo_dialog);
        alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(mContext.getResources().getColor(R.color.white_transperent)));
        alertDialog.show();

You can adjust this hash code according your transparency requirement. use link

Vidhi Dave
  • 5,614
  • 2
  • 33
  • 55