I also had this problem. It is better to use Dialog instead of AlertDialog . This is my decision:
Dialog dialog = new Dialog(getActivity(), R.style.Dialog_No_Border); dialog.setContentView(R.layout.some_dialog);
Contents of some_dialog.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="250dp" android:layout_height="350dp" android:orientation="vertical" android:background="@drawable/some_dialog_background"> <TextView ... /> <Button ... /> </LinearLayout>
styles.xml
<style name="Dialog_No_Border" parent="@android:style/Theme.Dialog"> <item name="android:windowIsFloating">true</item> <item name="android:windowBackground">@color/transparent_color</item> </style>
So finally, I have my own dialogue with a background without borders.
source share