2017-01-30 4 views
-1

wie posible ist, es zu tun, ich habe tatsächlich diesen Code:Popup-Fenster android mit alpha Rückansicht

public void openDialog() { 
    final Dialog dialog = new Dialog(this); // Context, this, etc. 
    dialog.setContentView(R.layout.fragment_wrongpass_reg); 
    dialog.setTitle("cualquier cosa"); 
    dialog.show(); 
} 

Ich brauche die die Rückseite Bildschirm mit Alpha zu setzen, ist es fast transparent, wie in diesem Bild zu machen:

here is the image

Antwort

1

Sie benötigen einen Vollbild-Dialog zu schaffen, setzen Sie sie mit einem benutzerdefinierten Thema.

erstellen Sie einen Vollbilddialog und legen Sie seinen Inhalt mit Innenpolsterung. etwas wie folgt aus:

<style name="Dialog_Fullscreen"> 
    <item name="android:windowActionBar">false</item> 
    <item name="android:layout_width">fill_parent</item> 
    <item name="android:layout_height">fill_parent</item> 
    <item name="android:windowNoTitle">true</item> 
    <item name="android:windowIsTranslucent">true</item> 
    <item name="android:windowBackground">@android:color/transparent</item> 
</style> 

schließlich stellen Sie den Dialog wie folgt aus::

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#cb000000" 
    android:padding="20dp"> 
    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:orientation="vertical" 
     .... 
     .... 
     YOUR CONTENT 
     .... 
     ..../> 
</RelativeLayout> 

Das benutzerdefinierte Thema sollte etwas wie dieses sein

final dialog = new Dialog(context, R.style.Dialog_Fullscreen); 
+0

Dont Arbeit, vielleicht Ich habe einen Fehler gemacht ... Ich habe die letzte Zeile hinzugefügt: final Dialog dialog = new Dialog (this, R.style.Dialog_Fullscreen); dialog.setContentView (R.layout.fragment_wrongpass_reg); dialog.setTitle ("Falscher Durchlauf"); dialog.show(); – baldcl

+0

das Thema ist nur für Vollbild .. der Trick ist im Layout mit der Polsterung. Ihr Layout sieht wie mein Beispiel aus? – Idanatz