MainActivity:
package com.home.testdialogborder;import android.app.Activity;import android.app.Dialog;import android.os.Bundle;import android.view.View;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);}public void click(View v) {if (v.getId() == R.id.main_btn_set) {Dialog dialog = new Dialog(MainActivity.this,R.style.NoBorderDialog);dialog.setContentView(R.layout.dialog);dialog.show();}}}
style.NoBorderDialog:
<style name="NoBorderDialog" parent="@android:style/Theme.Dialog"> <item name="android:windowFrame">@null</item> <item name="android:windowIsFloating">true</item> <item name="android:windowIsTranslucent">false</item> <item name="android:windowNoTitle">true</item> <item name="android:background">@android:color/black</item> <item name="android:windowBackground">@null</item> <item name="android:backgroundDimEnabled">false</item> </style>
布局檔案內容自訂即可