在style.xml中
- XML/HTML代码
- <?xml version="1.0" encoding="utf-8"?>
- <resources>
- <style name="dialog" parent="@android:style/Theme.Dialog">
- <item name="android:windowFrame">@null</item>
- <item name="android:windowIsFloating">true</item>
- <item name="android:windowIsTranslucent">true</item>
- <item name="android:windowNoTitle">true</item>
- <item name="android:background">@null</item>
- <item name="android:windowBackground">@null</item>
- <item name="android:backgroundDimEnabled">false</item>
- </style>
- </resources>
在代码中
- Java代码
- WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
- RelativeLayout view = (RelativeLayout) getLayoutInflater().inflate(R.layout.dialog, null);
- Dialog dialog = new Dialog(XXX.this,R.style.dialog);
- dialog.setContentView(view);
- dialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
- dialog.show();
转载于:https://blog.51cto.com/06peng/963357