【发布时间】:2019-11-27 14:50:03
【问题描述】:
我使用TimePicker 类和Spinner Mode。我想知道是否可以在NumberPickers 之间更改colon 的颜色。
我不是在寻找两个独立的 NumberPickers 和它们之间的 TextView。
【问题讨论】:
标签: java android colors spinner timepicker
我使用TimePicker 类和Spinner Mode。我想知道是否可以在NumberPickers 之间更改colon 的颜色。
我不是在寻找两个独立的 NumberPickers 和它们之间的 TextView。
【问题讨论】:
标签: java android colors spinner timepicker
如果您查看用于微调器样式的 Material TimePicker 的 layout,您会发现分隔符是一个简单的 TextView:
<TextView
android:id="@+id/divider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="6dip"
android:layout_marginEnd="6dip"
android:layout_gravity="center_vertical"
android:importantForAccessibility="no" />
更改它的简单方法是为您的选择器创建一个样式:
<style name="MyPickerTheme" parent="Theme.MaterialComponents...">
...
<item name="android:textColor">@color/myColor</item>
...
</style>
之后,为你的 TimePicker 设置主题:
<TimePicker
android:id="@+id/my_picker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/MyPickerTheme"
android:timePickerMode="spinner" />
【讨论】: