【问题标题】:Android Style Date Picker and Time Picker for API Lower Than 21适用于低于 21 的 API 的 Android 样式日期选择器和时间选择器
【发布时间】:2015-06-24 15:51:45
【问题描述】:

如何设置日期选择器和时间选择器的样式以更改文本颜色?我没有使用 TimePickerDialog 或 DatePickerDialog 而是创建了自己的对话框片段,它具有带有时间和日期选择器的视图寻呼机,它们分别位于 xml 文件中。对于低于 21 的 api 级别,我无法更改它们两个文本的颜色。

【问题讨论】:

    标签: android datepicker styles timepicker


    【解决方案1】:

    这是我通过将主题包装器传递给布局充气器来样式选择器的代码。

    上下文 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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-11
      • 2011-02-20
      • 2012-12-26
      相关资源
      最近更新 更多