在导航抽屉中动态添加项目 [英] Add items in Navigation Drawer Dynamically
本文介绍了在导航抽屉中动态添加项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了Drawer.但是我想设置抽屉的Itemlist是动态的,即从数据库中获取数据并设置为抽屉列表.是否有可能?是的,除了如何?我也知道静态抽屉.
I create Drawer.But I want to set Itemlist of drawer is dynamically.Means get data from database and set as drawerList. Is It Possible? and yes than How?I know static drawer as well.
推荐答案
尝试一下:
final Menu menu = navigationView.getMenu();
for (int i = 1; i <= 10; i++) {
menu.add("Runtime item "+ i);
}
这篇关于在导航抽屉中动态添加项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文