【发布时间】:2020-12-24 05:12:53
【问题描述】:
我通过这段代码修复了状态栏颜色为白色
<style name="BaseTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:statusBarColor">@color/white</item>
<item name="android:windowLightStatusBar" tools:targetApi="M">true</item>
</style>
所以,状态栏是白色的,图标是黑色的。
在我的项目中,我使用库 StfalconImageViewer 来显示图像。
private fun showImageViewer(sourceImageView: ImageView?, position: Int) {
val imageLoader = ImageLoader<String> { imageView, imageUrl ->
loadImage(imageView, imageUrl)
}
StfalconImageViewer.Builder(context, imageUrls, imageLoader)
.withHiddenStatusBar(false)
.withStartPosition(position)
.withTransitionFrom(sourceImageView)
.show()
}
当显示对话框时,我看到状态栏又回来了,图标也是黑色的(因为我用上面的代码固定了颜色)。
如何使状态栏图标颜色自动更改,如果状态栏为黑色,图标颜色自动更改为白色。或者,另一种询问方式:我想显示 StfalconImageViewer,状态栏图标颜色为白色。
请给我一些建议。
提前致谢。
【问题讨论】:
-
你参考了这个例子吗? medium.com/@imstudio/…
-
感谢@ModiHarsh,我还没有尝试使用java代码进行配置,但我认为它不会在统计栏颜色和状态栏图标颜色之间自动切换。