Dynamic Menus in NavigationView

后端 未结 4 721
[愿得一人]
[愿得一人] 2021-02-14 02:42

I have this Layout:



        
4条回答
  •  野的像风
    2021-02-14 03:30

    Seems like kmi.getId() returns int(or long).

    But Menu.add(int) adds menu with title from the given string resources, which is usually represented as R.string.something, and not for usual integer values.

    Menu.add(CharSequence) does add menu with title of CharSequence, so you need to do some int-to-string conversion like menu.add(kmi.getId() + "");

提交回复
热议问题