Erforderliche Ausgabebild:Benutzerdefinierte Dialog mit weißen transparentem Hintergrund
Ich habe den Code versucht und meine Ausgabe ist wie folgt. Bitte helfen Sie mir, die Ausgabe zu produzieren, wie ich gezeigt habe.
Mein Code:
In Aktivität:
@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>
Meine Ausgabe:
Ich brauche einen weißen transparenten Hintergrund und die Ausrichtungen wie im gewünschten Ausgabebild gezeigt. Bitte helfen Sie mir mit einigen Vorschlägen.
upvote eine Antwort, wenn es Ihr Problem gelöst hat –