简体   繁体   English

更改时间选择器的文本颜色 [android]

[英]change the text color of Time Picker [android]

How can I Change the Text color of Time picker in android ..... I am having a black shadow background in my application and by default the time in Time picker is also in black so the time is not visible....如何更改 android 中时间选择器的文本颜色.....我的应用程序中有黑色阴影背景,默认情况下时间选择器中的时间也是黑色的,因此时间不可见....在此处输入图像描述

The default view of the time picker is时间选择器的默认视图是

在此处输入图像描述

my XMl Entry is :我的 XML 条目是:

  <TimePicker
                    android:id="@+id/timePicker"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" />

android Java code is : android Java代码是:

timePicker  = (TimePicker)findViewById(R.id.timePicker);
hour = calendar.get(Calendar.HOUR_OF_DAY);
        minute = calendar.get(Calendar.MINUTE);

    timePicker.setCurrentHour(hour);

    timePicker.setCurrentMinute(minute);

You could create your own XML layout for the datepicker as in the example here .您可以为日期选择器创建自己的 XML 布局,如此处的示例所示

Not sure how well this will play with your activity if it is extending FragmentActivity, but should give you a start in the right direction.如果它正在扩展 FragmentActivity,不确定这将如何与您的活动一起发挥作用,但应该让您朝着正确的方向开始。

转到res > values > theme.xml并在样式标签内添加一个带有属性“android:textColorPrimary”的项目并设置您想要的颜色。

<item name="android:textColorPrimary">@color/white</item>

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

相关问题 如何在Android中更改时间选择器字体颜色? - How to Change Time Picker Font Color in Android? 使用Android中的颜色选择器更改TextView的文本颜色和背景颜色 - Change text color and background color of textview using color picker in android 如何更改Android中时间选择器的钟面和钟针颜色 - How to change color of the clock face and clock hand of time picker in Android 如何更改 Android 中的材料日期和时间选择器背景颜色? - How to change the Material Date & Time Picker background color in Android? Android时间选择器(以编程方式更改时针颜色) - Android Time Picker (change clock hand Color programmatically) 在 android 的微调器模式下更改日期选择器文本颜色? - Change date-picker text color in spinner mode in android? 如何在 Android 中更改 Number Picker 中心文本颜色 - How to change Number Picker center text color in Android 更改时间选择器的主题-Android - Change Theme of Time Picker - Android 更改日期选择器,时间选择器和对话框分隔符的颜色 - change datepicker, time picker and dialog separators color 更改Google地方选取器应用栏文本颜色 - Change Google Place Picker Appbar Text Color
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM