简体   繁体   English

datepickerdialog theme_holo_light无法在Samsung J7 Core中正确显示

[英]datepickerdialog theme_holo_light not displayed correctly in Samsung J7 Core

I use java code to display datepickerdialog with a theme THEME_HOLO_LIGHT. 我使用Java代码显示主题为THEME_HOLO_LIGHT的datepickerdialog。 My compiled SDK version is 27. The theme is displayed perfectly in an oppo device (Nougat 7.0). 我编译的SDK版本是27。主题在oppo设备(Nougat 7.0)中完美显示。 However, in samsung J7 Core, the output is a different THEME. 但是,在三星J7 Core中,输出是不同的主题。

Sample output of THEME_HOLO_LIGHT THEME_HOLO_LIGHT的样本输出

The result of an output in Samsung is THEME_DEVICE_DEFAULT_DARK. Samsung中的输出结果为THEME_DEVICE_DEFAULT_DARK。

I want the THEME_HOLO_LIGHT to display. 我希望显示THEME_HOLO_LIGHT。 Please help. 请帮忙。

datePickerDialog = new DatePickerDialog(this,AlertDialog.THEME_HOLO_LIGHT, new DatePickerDialog.OnDateSetListener() {
        @Override
        public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
            DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
            USERBIRTHDATE = dateFormat.format(new Date(year - 1900, month, dayOfMonth));
            dateTxt.setText(USERBIRTHDATE);
            flag = true;
        }
    }, 1997, 0, 01);

Instead of AlertDialog.THEME_HOLO_LIGHT write android.R.style.Theme_Holo_Light . 而不是AlertDialog.THEME_HOLO_LIGHT编写android.R.style.Theme_Holo_Light
If this doesn't work, replace it with this: 如果这不起作用,请替换为:

datePickerDialog = new DatePickerDialog(this,new ContextThemeWrapper(this, android.R.style.Theme_Holo_Light), new DatePickerDialog.OnDateSetListener() {..}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM