[英]Color Icon in the Bottom Navigation Activity
Question题
how Can I use colored icon in the Bottom Navigation Activity
?如何在底部
Navigation Activity
使用彩色图标? I have a logo which I placed in the drawable folder but in the navigation bar its showing in black and white color instead of regular color as I copied in the drawable folder.我有一个徽标,我将其放置在 drawable 文件夹中,但在导航栏中,它以黑色和白色显示,而不是我在 drawable 文件夹中复制的常规颜色。 Please share your thoughts.
请分享您的想法。 I am using kotlin language.
我正在使用kotlin语言。
For example : this code use in the Activity in the onCreate 例如:此代码在onCreate的Activity中使用
// test = your icon SVG in drawable
test.setColorFilter(R.color."choice your color here in color folder")
You can try using bottomNavigationView.setItemIconTintList(null);
您可以尝试使用
bottomNavigationView.setItemIconTintList(null);
. 。 This may work.
这可能有效。 But still, I'll suggest using a different library as mentioned in my comment.
但是,我还是建议使用我评论中提到的其他库。
You have to provide color in onClick
listener using 您必须使用以下方法在
onClick
侦听器中提供颜色
window.navigationBarColor = Color.GREEN
Use Color.parseColor() to set some custom color to Navigation Bar
使用Color.parseColor()为导航栏设置一些自定义颜色
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.