Closed ashu5398 closed 3 years ago
The BottomNavigtaionView is supported out of the box, as this lib contains a ViewTransfomer for it. I just integrated a BottomNavigationView into my sample app and everything works fine there.
Your code above looks correct, you may try to recreate the issue by forking my sample app and integrate your BottomNavigationView in the same way as in your real app. If this does not recreate the issue it may be due to something specific for your app. It may also depend on some specific version of the material lib or other libs used in your project.
Oh Thanks!! I got the issue, I have not defined the id's for menu items. Also Just want to know one thing, the same way we are transforming the BottomNavigationMenu items, can we transform the menu items of the toolbar/support toolbar, so that strings of popup menu also got translated easily. As PopupMenu does not extends View we can not make its transformer directly, Or is there any other way to update popup menu strings?
You're welcome :) Yes, it should work the same way with Toolbar/support Toolbar as with the BottomNavigationItems.
Basically something like this in the ToolbarViewTransformer:
override fun Toolbar.transform(attrs: Map<String, Int>) {
attrs.forEach { entry ->
when (entry.key) {
ATTRIBUTE_TITLE, ATTRIBUTE_ANDROID_TITLE -> updateTexts(entry.value, this::setTitle)
ATTRIBUTE_SUBTITLE, ATTRIBUTE_ANDROID_SUBTITLE -> updateTexts(entry.value, this::setSubtitle)
SOME_ATTRIBUTE -> menu.getItem(...).setTitle()
}
}
}
I don't have the time to look into this at the moment, but maybe in the next weeks, this would definitely be a good improvement for the lib. If you want the feature now you can implement it though and create a PR :)
PR added with the update: https://github.com/B3nedikt/reword/pull/14 :)
@ashu5398 Released as version 2.1.0, thanks for the contribution :)
Hi, I am unable to change the strings inflated in bottom Navigation Menu. Here is my code of bottomNavigationMenu. Is there anything I am missing on my end?