1

我正在使用至极MaterialDrawer Library我设置我的抽屉被倒塌的项目得到thier名字和他们的子项对火力地堡数据库名称刷新崩itemDrawer

但是当我添加一个子项但这并没有出现直到我折叠和再次expande塌陷项目i如何notife它从GitHub

RootRef.addChildEventListener(new ChildEventListener() { 
     @Override 
     public void onChildAdded(DataSnapshot dataSnapshot, String s) { 
      final int[] t = {0}; 
      Log.i("s =", String.valueOf(dataSnapshot.getKey())); 
      final ExpandableDrawerItem IntentItemDrawer; 

      result.addItem(IntentItemDrawer = new ExpandableDrawerItem() 
        .withName(String.valueOf(dataSnapshot.getKey())) 
        .withIcon(GoogleMaterial.Icon.gmd_collection_case_play) 
        .withIdentifier(t[0]++).withSelectable(false) 
        .withSubItems()); 

      RootRef.child(String.valueOf(dataSnapshot.getKey())) 
        .addChildEventListener(new ChildEventListener() { 
       @Override 
       public void onChildAdded(DataSnapshot dataSnapshot, String s) { 
        IntentItemDrawer.withSubItems(new SecondaryDrawerItem() 
          .withName(String.valueOf(dataSnapshot.getKey())) 
          .withLevel(2) 
          .withIcon(GoogleMaterial.Icon.gmd_8tracks) 
          .withIdentifier(t[ 

回答

3

实施例添加数据时:

//modify an item of the drawer 
 
item1.withName("A new name for this drawerItem").withBadge("19").withBadgeStyle(new BadgeStyle().withTextColor(Color.WHITE).withColorRes(R.color.md_red_700)); 
 
//notify the drawer about the updated element. it will take care about everything else 
 
result.updateItem(item1);

result.updateItem(/ 您的项目 /);

展开视图尝试这一行:

result.getAdapter()toggleExpandable(位置);

+0

谢谢你,我很遗憾没有重读文档 –

+0

,但你知道如何重新展开视图automaticaly? –

+1

我不知道它会工作btu我发现这行代码,我会编辑我的答案 –