2016-10-25 102 views
0

我想刪除多餘的背景DatePickerDialog如何刪除DatePickerDialog背景

enter image description here

這是我的代碼

DatePickerDialog dpd = new DatePickerDialog(RegisterActivity.this, android.R.style.Theme_Holo_Dialog, date, 
         myCalendar.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), 
         myCalendar.get(Calendar.DAY_OF_MONTH)); 
+2

[DatePickerDialog顯示兩個邊框]的可能重複(http://stackoverflow.com/questions/25205161/datepickerdialog-displays-with-two-borders) –

回答

1

您可以覆蓋對話的主題是這樣的:

<style name="TransparentDatePickerDialogTheme" parent="AlertDialog.AppCompat"> 
    <item name="android:windowBackground">@android:color/transparent</item> 
</style> 

然後應用這樣的主題

DatePickerDialog dpd = new DatePickerDialog(RegisterActivity.this, R.style.TransparentDatePickerDialogTheme, date, 
        myCalendar.get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), 
        myCalendar.get(Calendar.DAY_OF_MONTH));