Android TimePickerDialog文字颜色

时间:2016-05-04 13:25:27

标签: android material-design

当我在Android中使用TimePickerDialog> = 5时,一切正常。但在Android 4.4中,未选择项目的文本颜色为白色(或透明)。怎么了?

enter image description here

styles.xml

<!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
使用

public class PickTimeDialog {

    public interface Callback {
        void onTimePicked(String timeStr);
    }

    private TimePickerDialog timePickerDialog;

    public PickTimeDialog(Context context, Callback callback) {
        timePickerDialog = new TimePickerDialog(context,
                (view, hourOfDay, minute) -> {
                    String timeStr = DateUtils.format(hourOfDay, minute, DateUtils.TIME_FORMAT);
                    callback.onTimePicked(timeStr);
        }, 0, 0, true);
    }

    public void show() {
        timePickerDialog.show();
    }
}

0 个答案:

没有答案