gpt4 book ai didi

android - 具有背景的 DatePicker

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:52:28 28 4
gpt4 key购买 nike

问题是我的日期选择器在日期选择器后面有一个丑陋的白色背景

White background

我只想让那个背景消失

这是我的代码

 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);
}
}

这是我的风格

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

</style>

最佳答案

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

将此添加到您的 DatePickerDialog

关于android - 具有背景的 DatePicker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27101906/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com