【发布时间】:2015-06-24 15:51:45
【问题描述】:
如何设置日期选择器和时间选择器的样式以更改文本颜色?我没有使用 TimePickerDialog 或 DatePickerDialog 而是创建了自己的对话框片段,它具有带有时间和日期选择器的视图寻呼机,它们分别位于 xml 文件中。对于低于 21 的 api 级别,我无法更改它们两个文本的颜色。
【问题讨论】:
标签: android datepicker styles timepicker
如何设置日期选择器和时间选择器的样式以更改文本颜色?我没有使用 TimePickerDialog 或 DatePickerDialog 而是创建了自己的对话框片段,它具有带有时间和日期选择器的视图寻呼机,它们分别位于 xml 文件中。对于低于 21 的 api 级别,我无法更改它们两个文本的颜色。
【问题讨论】:
标签: android datepicker styles timepicker
这是我通过将主题包装器传递给布局充气器来样式选择器的代码。
上下文 contextThemeWrapper = new ContextThemeWrapper( 语境, android.R.style.Theme_Holo_Light);
LayoutInflater inflater = LayoutInflater.from(context);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View rootView = localInflater.inflate(R.layout.view_timepicker, container, false);
【讨论】: