Lele
Lele

Reputation: 703

Dialog at full screen (or with trasparent background)

i've tried a lot... nothig... i create this thema

    <style name="MyDialogTheme" parent="android:Theme.Dialog">
        <!-- Fill the screen -->
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">fill_parent</item>

        <!-- No backgrounds, titles or window float -->
        <item name="android:windowBackground">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsFloating">false</item>      

        <!-- Just to prove it's working -->
        <item name="android:background">#ff0000</item>
    </style>

<item name="android:windowBackground">@null</item> -> don't work (i see the red backgroun from ff0000)

same this

 final AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this,Android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);

and

 helpDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

how to get a trasnaprent background? this is a screen (Imagine the part in gray at full screen or trasparent, not with margin) Link to preview

Upvotes: 0

Views: 4574

Answers (2)

Noob
Noob

Reputation: 2927

try this , will show full screen loading dialog with transparent background

Dialog dialog = new Dialog(Wallpapers.this);
dialog = new Dialog(context);
               dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
               dialog.setContentView(R.layout.dialog);
               dialog.setCancelable(false);
               dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
               dialog.show();

create xml layout in (res/layout/dialog.xml) and put this code inside it

<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
</ProgressBar>

Upvotes: 3

MSA
MSA

Reputation: 2482

If you want your dialog to be transparent, use this:

color.xml

<color name="transparent">#00000000</color>

Layout:

android:background="@color/transparent"

For pop-up full screen use this:

Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();  // deprecated
int height = display.getHeight();  // deprecated

showAtLocation(layout, Gravity.NO_GRAVITY,width , height );

For Dialog use this:

 getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);

Cheers

Upvotes: 1

Related Questions