Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatePicker having a background

the problem is that my date picker having an ugly White background behind the date picker

White background

i just want that background to Disappear

this is My code

 public void selectDate(View view) {
    DialogFragment newFragment = new SelectDateFragment();
    newFragment.show(Master_.fragmentManager, "DatePicker");
}

public void populateSetDate(int year, int month, int day) {


        Birthdate.setText(year + "-" + month + "-" + day);

}

public class SelectDateFragment extends DialogFragment implements
        DatePickerDialog.OnDateSetListener {
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final Calendar calendar = Calendar.getInstance();
        int yy = calendar.get(Calendar.YEAR);
        int mm = calendar.get(Calendar.MONTH);
        int dd = calendar.get(Calendar.DAY_OF_MONTH);

    DatePickerDialog dialog =new DatePickerDialog(mActivity,R.style.jehadStyle, this, yy, mm, dd);  
    dialog.getDatePicker().setMaxDate(calendar.getTimeInMillis());  

    return dialog ;
    }

    public void onDateSet(DatePicker view, int yy, int mm, int dd) {
        populateSetDate(yy, mm + 1, dd);
    }
}

and this is my style

 <style name="jehadStyle" parent="@android:style/Theme.Holo.Light.Dialog.NoActionBar">
    <item name="android:textColor">@android:color/black</item>

</style>
like image 793
Jehad Avatar asked Nov 24 '14 09:11

Jehad


3 Answers

dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

add this to your DatePickerDialog

like image 117
Arun Salaria Avatar answered Nov 20 '22 14:11

Arun Salaria


try like this,

<style name="jehadStyle" parent="@android:style/Theme.Holo.Light.Dialog.NoActionBar">
        <item name="android:textColor">@android:color/black</item>
        <item name="android:background">@null</item>
    </style>

hope it will help you

like image 41
Akash Moradiya Avatar answered Nov 20 '22 14:11

Akash Moradiya


dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));

use with DatePickerDialog

like image 26
Nitish Gupta Avatar answered Nov 20 '22 16:11

Nitish Gupta