voi*_*d42 1 timepicker react-native react-native-android
是否可以更改TimePickerAndroid组件的默认颜色?
Jop*_*son 10
你必须从android的styles.xml文件中更改它.这是你做的:
1)打开styles.xml:"android/app/src/main/res/values/styles.xml"2)你需要添加几行:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:timePickerDialogTheme">@style/Dialog.Theme</item>
</style>
<style name="Dialog.Theme" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF0000</item>
<item name="android:textColorPrimary">#0000FF</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在styles.xml中,您应该已经拥有:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
Run Code Online (Sandbox Code Playgroud)
如果你只是添加剩余的行.如果没有继续添加它们.
4)最后,只需重新编译应用程序."react-native run-android".您应该立即看到颜色变化.
| 归档时间: |
|
| 查看次数: |
3002 次 |
| 最近记录: |