刷新折叠的 itemDrawer
Refresh Collapsing itemDrawer
我正在使用 MaterialDrawer Library,我在其中将我的抽屉设置为折叠项目获取 Firebase 数据库的名称及其子项目的名称
但是,当我添加一个子项目时,它不会出现,直到我再次折叠并展开折叠的项目。添加数据时如何通知?
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[
示例来自 github:
//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(position);
我正在使用 MaterialDrawer Library,我在其中将我的抽屉设置为折叠项目获取 Firebase 数据库的名称及其子项目的名称
但是,当我添加一个子项目时,它不会出现,直到我再次折叠并展开折叠的项目。添加数据时如何通知?
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[
示例来自 github:
//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(position);