dynamic adding item to NavigationView in Android
I want to build NavigationDrawer
with the possibility of adding new items (such as yahoo weather App with adding new cities). I have working NavigationDrawer
with NavigationView
, in menu I have permanent fields:
<group
android:id="@+id/group"
android:checkableBehavior="single">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
I'm trying to add new Item this method:
public boolean addNewItem(String itemName)
Menu menu = navigationView.getMenu();
menu.add(R.id.group,Menu.NONE,Menu.NONE,itemName);
return true;
And I'm getting not exactly what I want:
Does anyone have an idea how to solve this problem? Or why is this happening?
I do not know where and how one can hold information about the added elements. Any ideas?
android navigation-drawer android-menu
add a comment |
I want to build NavigationDrawer
with the possibility of adding new items (such as yahoo weather App with adding new cities). I have working NavigationDrawer
with NavigationView
, in menu I have permanent fields:
<group
android:id="@+id/group"
android:checkableBehavior="single">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
I'm trying to add new Item this method:
public boolean addNewItem(String itemName)
Menu menu = navigationView.getMenu();
menu.add(R.id.group,Menu.NONE,Menu.NONE,itemName);
return true;
And I'm getting not exactly what I want:
Does anyone have an idea how to solve this problem? Or why is this happening?
I do not know where and how one can hold information about the added elements. Any ideas?
android navigation-drawer android-menu
Did you see the source of drawer? If you change something in drawer, remember to invalidate it/reload
– deadfish
Jul 30 '15 at 12:29
Ofc, the problem is that I cannot add new item below Item2. When I call method addNewItem, new item doesn't appear in the first group above the separator, but at the bottom of the menu.
– Skye
Jul 30 '15 at 12:40
what about methodaddHeaderView()
?
– deadfish
Jul 30 '15 at 12:49
@Skye have you found a workaround for this? Am having the exact same problem.
– irobotxxx
Sep 24 '15 at 15:08
@manuelJ yes, when you have items with icons/images and when you try to add item dynamically, this item will be added below the current items. I also try custom libraries and it didnt work too. My solution is to write items into xml file, and after adding or deleting item (from xml file) drawer menu should be loaded again.
– Skye
Sep 24 '15 at 22:26
add a comment |
I want to build NavigationDrawer
with the possibility of adding new items (such as yahoo weather App with adding new cities). I have working NavigationDrawer
with NavigationView
, in menu I have permanent fields:
<group
android:id="@+id/group"
android:checkableBehavior="single">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
I'm trying to add new Item this method:
public boolean addNewItem(String itemName)
Menu menu = navigationView.getMenu();
menu.add(R.id.group,Menu.NONE,Menu.NONE,itemName);
return true;
And I'm getting not exactly what I want:
Does anyone have an idea how to solve this problem? Or why is this happening?
I do not know where and how one can hold information about the added elements. Any ideas?
android navigation-drawer android-menu
I want to build NavigationDrawer
with the possibility of adding new items (such as yahoo weather App with adding new cities). I have working NavigationDrawer
with NavigationView
, in menu I have permanent fields:
<group
android:id="@+id/group"
android:checkableBehavior="single">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
I'm trying to add new Item this method:
public boolean addNewItem(String itemName)
Menu menu = navigationView.getMenu();
menu.add(R.id.group,Menu.NONE,Menu.NONE,itemName);
return true;
And I'm getting not exactly what I want:
Does anyone have an idea how to solve this problem? Or why is this happening?
I do not know where and how one can hold information about the added elements. Any ideas?
android navigation-drawer android-menu
android navigation-drawer android-menu
edited Jul 30 '15 at 11:59
EliaszKubala
2,2441227
2,2441227
asked Jul 30 '15 at 11:28
SkyeSkye
4511623
4511623
Did you see the source of drawer? If you change something in drawer, remember to invalidate it/reload
– deadfish
Jul 30 '15 at 12:29
Ofc, the problem is that I cannot add new item below Item2. When I call method addNewItem, new item doesn't appear in the first group above the separator, but at the bottom of the menu.
– Skye
Jul 30 '15 at 12:40
what about methodaddHeaderView()
?
– deadfish
Jul 30 '15 at 12:49
@Skye have you found a workaround for this? Am having the exact same problem.
– irobotxxx
Sep 24 '15 at 15:08
@manuelJ yes, when you have items with icons/images and when you try to add item dynamically, this item will be added below the current items. I also try custom libraries and it didnt work too. My solution is to write items into xml file, and after adding or deleting item (from xml file) drawer menu should be loaded again.
– Skye
Sep 24 '15 at 22:26
add a comment |
Did you see the source of drawer? If you change something in drawer, remember to invalidate it/reload
– deadfish
Jul 30 '15 at 12:29
Ofc, the problem is that I cannot add new item below Item2. When I call method addNewItem, new item doesn't appear in the first group above the separator, but at the bottom of the menu.
– Skye
Jul 30 '15 at 12:40
what about methodaddHeaderView()
?
– deadfish
Jul 30 '15 at 12:49
@Skye have you found a workaround for this? Am having the exact same problem.
– irobotxxx
Sep 24 '15 at 15:08
@manuelJ yes, when you have items with icons/images and when you try to add item dynamically, this item will be added below the current items. I also try custom libraries and it didnt work too. My solution is to write items into xml file, and after adding or deleting item (from xml file) drawer menu should be loaded again.
– Skye
Sep 24 '15 at 22:26
Did you see the source of drawer? If you change something in drawer, remember to invalidate it/reload
– deadfish
Jul 30 '15 at 12:29
Did you see the source of drawer? If you change something in drawer, remember to invalidate it/reload
– deadfish
Jul 30 '15 at 12:29
Ofc, the problem is that I cannot add new item below Item2. When I call method addNewItem, new item doesn't appear in the first group above the separator, but at the bottom of the menu.
– Skye
Jul 30 '15 at 12:40
Ofc, the problem is that I cannot add new item below Item2. When I call method addNewItem, new item doesn't appear in the first group above the separator, but at the bottom of the menu.
– Skye
Jul 30 '15 at 12:40
what about method
addHeaderView()
?– deadfish
Jul 30 '15 at 12:49
what about method
addHeaderView()
?– deadfish
Jul 30 '15 at 12:49
@Skye have you found a workaround for this? Am having the exact same problem.
– irobotxxx
Sep 24 '15 at 15:08
@Skye have you found a workaround for this? Am having the exact same problem.
– irobotxxx
Sep 24 '15 at 15:08
@manuelJ yes, when you have items with icons/images and when you try to add item dynamically, this item will be added below the current items. I also try custom libraries and it didnt work too. My solution is to write items into xml file, and after adding or deleting item (from xml file) drawer menu should be loaded again.
– Skye
Sep 24 '15 at 22:26
@manuelJ yes, when you have items with icons/images and when you try to add item dynamically, this item will be added below the current items. I also try custom libraries and it didnt work too. My solution is to write items into xml file, and after adding or deleting item (from xml file) drawer menu should be loaded again.
– Skye
Sep 24 '15 at 22:26
add a comment |
2 Answers
2
active
oldest
votes
To add the Item programmatically, we can get a Menu object using getMenu()
method of NavigationView
and then we can add Items into the navigation drawer using that Menu
object.
final Menu menu = navigationView.getMenu();
for (int i = 1; i <= 3; i++)
menu.add("Runtime item "+ i);
Using SubMenu
, we can add a subsection and Items into it.
// adding a section and items into it
final SubMenu subMenu = menu.addSubMenu("SubMenu Title");
for (int i = 1; i <= 2; i++)
subMenu.add("SubMenu Item " + i);
for more details Check TechnoTalkative.
EDIT:
If you want to interact with the menu, use menu.add(0, itemId, 0, title);
and then
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
id will give you assigned itemId
Everything is ok but it isn't what I mean. It only works when I remove Settings and About items :/
– Skye
Jul 30 '15 at 12:45
How about adding icon to the item? I think thats not possible.
– Alp Altunel
Oct 6 '16 at 8:23
7
For adding an icon, menu.add() returns the menuItem, on which you can call setIcon().
– Doug Simonton
Oct 20 '16 at 5:16
Thanks for sharing my blog link :)
– Paresh Mayani
Nov 9 '17 at 12:37
add a comment |
Suppose you have two groups, group1 and group2. If you want to dynamically add items to group1, then you can assign priority to group2 to make it always below group1. Then when you add new items to group1, it won't be inserted below group2.
Here is a sample:
<group android:id="@+id/group1" />
<group
android:id="@+id/group2"
android:orderInCategory="999">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
And when you add menu items to group1:
Menu menu = navigationView.getMenu();
menu.add(R.id.group1,Menu.NONE,Menu.NONE,itemName);
This should work. I tested it on Android design library 23.1.1.
Menu has added but it's always added in top position, I can't add it in desire position. any Idea
– Hitesh Dhamshaniya
May 30 '17 at 5:56
@HiteshDhamshaniya you can still use order parameter in Menu.add() method. Larger order will be sorted in bottom.
– Hexise
Jul 11 '17 at 7:41
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31722566%2fdynamic-adding-item-to-navigationview-in-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To add the Item programmatically, we can get a Menu object using getMenu()
method of NavigationView
and then we can add Items into the navigation drawer using that Menu
object.
final Menu menu = navigationView.getMenu();
for (int i = 1; i <= 3; i++)
menu.add("Runtime item "+ i);
Using SubMenu
, we can add a subsection and Items into it.
// adding a section and items into it
final SubMenu subMenu = menu.addSubMenu("SubMenu Title");
for (int i = 1; i <= 2; i++)
subMenu.add("SubMenu Item " + i);
for more details Check TechnoTalkative.
EDIT:
If you want to interact with the menu, use menu.add(0, itemId, 0, title);
and then
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
id will give you assigned itemId
Everything is ok but it isn't what I mean. It only works when I remove Settings and About items :/
– Skye
Jul 30 '15 at 12:45
How about adding icon to the item? I think thats not possible.
– Alp Altunel
Oct 6 '16 at 8:23
7
For adding an icon, menu.add() returns the menuItem, on which you can call setIcon().
– Doug Simonton
Oct 20 '16 at 5:16
Thanks for sharing my blog link :)
– Paresh Mayani
Nov 9 '17 at 12:37
add a comment |
To add the Item programmatically, we can get a Menu object using getMenu()
method of NavigationView
and then we can add Items into the navigation drawer using that Menu
object.
final Menu menu = navigationView.getMenu();
for (int i = 1; i <= 3; i++)
menu.add("Runtime item "+ i);
Using SubMenu
, we can add a subsection and Items into it.
// adding a section and items into it
final SubMenu subMenu = menu.addSubMenu("SubMenu Title");
for (int i = 1; i <= 2; i++)
subMenu.add("SubMenu Item " + i);
for more details Check TechnoTalkative.
EDIT:
If you want to interact with the menu, use menu.add(0, itemId, 0, title);
and then
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
id will give you assigned itemId
Everything is ok but it isn't what I mean. It only works when I remove Settings and About items :/
– Skye
Jul 30 '15 at 12:45
How about adding icon to the item? I think thats not possible.
– Alp Altunel
Oct 6 '16 at 8:23
7
For adding an icon, menu.add() returns the menuItem, on which you can call setIcon().
– Doug Simonton
Oct 20 '16 at 5:16
Thanks for sharing my blog link :)
– Paresh Mayani
Nov 9 '17 at 12:37
add a comment |
To add the Item programmatically, we can get a Menu object using getMenu()
method of NavigationView
and then we can add Items into the navigation drawer using that Menu
object.
final Menu menu = navigationView.getMenu();
for (int i = 1; i <= 3; i++)
menu.add("Runtime item "+ i);
Using SubMenu
, we can add a subsection and Items into it.
// adding a section and items into it
final SubMenu subMenu = menu.addSubMenu("SubMenu Title");
for (int i = 1; i <= 2; i++)
subMenu.add("SubMenu Item " + i);
for more details Check TechnoTalkative.
EDIT:
If you want to interact with the menu, use menu.add(0, itemId, 0, title);
and then
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
id will give you assigned itemId
To add the Item programmatically, we can get a Menu object using getMenu()
method of NavigationView
and then we can add Items into the navigation drawer using that Menu
object.
final Menu menu = navigationView.getMenu();
for (int i = 1; i <= 3; i++)
menu.add("Runtime item "+ i);
Using SubMenu
, we can add a subsection and Items into it.
// adding a section and items into it
final SubMenu subMenu = menu.addSubMenu("SubMenu Title");
for (int i = 1; i <= 2; i++)
subMenu.add("SubMenu Item " + i);
for more details Check TechnoTalkative.
EDIT:
If you want to interact with the menu, use menu.add(0, itemId, 0, title);
and then
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
id will give you assigned itemId
edited Nov 14 '18 at 8:56
reverie_ss
468415
468415
answered Jul 30 '15 at 11:43
Pankaj AroraPankaj Arora
8,76813254
8,76813254
Everything is ok but it isn't what I mean. It only works when I remove Settings and About items :/
– Skye
Jul 30 '15 at 12:45
How about adding icon to the item? I think thats not possible.
– Alp Altunel
Oct 6 '16 at 8:23
7
For adding an icon, menu.add() returns the menuItem, on which you can call setIcon().
– Doug Simonton
Oct 20 '16 at 5:16
Thanks for sharing my blog link :)
– Paresh Mayani
Nov 9 '17 at 12:37
add a comment |
Everything is ok but it isn't what I mean. It only works when I remove Settings and About items :/
– Skye
Jul 30 '15 at 12:45
How about adding icon to the item? I think thats not possible.
– Alp Altunel
Oct 6 '16 at 8:23
7
For adding an icon, menu.add() returns the menuItem, on which you can call setIcon().
– Doug Simonton
Oct 20 '16 at 5:16
Thanks for sharing my blog link :)
– Paresh Mayani
Nov 9 '17 at 12:37
Everything is ok but it isn't what I mean. It only works when I remove Settings and About items :/
– Skye
Jul 30 '15 at 12:45
Everything is ok but it isn't what I mean. It only works when I remove Settings and About items :/
– Skye
Jul 30 '15 at 12:45
How about adding icon to the item? I think thats not possible.
– Alp Altunel
Oct 6 '16 at 8:23
How about adding icon to the item? I think thats not possible.
– Alp Altunel
Oct 6 '16 at 8:23
7
7
For adding an icon, menu.add() returns the menuItem, on which you can call setIcon().
– Doug Simonton
Oct 20 '16 at 5:16
For adding an icon, menu.add() returns the menuItem, on which you can call setIcon().
– Doug Simonton
Oct 20 '16 at 5:16
Thanks for sharing my blog link :)
– Paresh Mayani
Nov 9 '17 at 12:37
Thanks for sharing my blog link :)
– Paresh Mayani
Nov 9 '17 at 12:37
add a comment |
Suppose you have two groups, group1 and group2. If you want to dynamically add items to group1, then you can assign priority to group2 to make it always below group1. Then when you add new items to group1, it won't be inserted below group2.
Here is a sample:
<group android:id="@+id/group1" />
<group
android:id="@+id/group2"
android:orderInCategory="999">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
And when you add menu items to group1:
Menu menu = navigationView.getMenu();
menu.add(R.id.group1,Menu.NONE,Menu.NONE,itemName);
This should work. I tested it on Android design library 23.1.1.
Menu has added but it's always added in top position, I can't add it in desire position. any Idea
– Hitesh Dhamshaniya
May 30 '17 at 5:56
@HiteshDhamshaniya you can still use order parameter in Menu.add() method. Larger order will be sorted in bottom.
– Hexise
Jul 11 '17 at 7:41
add a comment |
Suppose you have two groups, group1 and group2. If you want to dynamically add items to group1, then you can assign priority to group2 to make it always below group1. Then when you add new items to group1, it won't be inserted below group2.
Here is a sample:
<group android:id="@+id/group1" />
<group
android:id="@+id/group2"
android:orderInCategory="999">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
And when you add menu items to group1:
Menu menu = navigationView.getMenu();
menu.add(R.id.group1,Menu.NONE,Menu.NONE,itemName);
This should work. I tested it on Android design library 23.1.1.
Menu has added but it's always added in top position, I can't add it in desire position. any Idea
– Hitesh Dhamshaniya
May 30 '17 at 5:56
@HiteshDhamshaniya you can still use order parameter in Menu.add() method. Larger order will be sorted in bottom.
– Hexise
Jul 11 '17 at 7:41
add a comment |
Suppose you have two groups, group1 and group2. If you want to dynamically add items to group1, then you can assign priority to group2 to make it always below group1. Then when you add new items to group1, it won't be inserted below group2.
Here is a sample:
<group android:id="@+id/group1" />
<group
android:id="@+id/group2"
android:orderInCategory="999">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
And when you add menu items to group1:
Menu menu = navigationView.getMenu();
menu.add(R.id.group1,Menu.NONE,Menu.NONE,itemName);
This should work. I tested it on Android design library 23.1.1.
Suppose you have two groups, group1 and group2. If you want to dynamically add items to group1, then you can assign priority to group2 to make it always below group1. Then when you add new items to group1, it won't be inserted below group2.
Here is a sample:
<group android:id="@+id/group1" />
<group
android:id="@+id/group2"
android:orderInCategory="999">
<item
android:checked="false"
android:id="@+id/item1"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item1" />
<item
android:checked="false"
android:id="@+id/Item2"
android:icon="@drawable/ic_inbox_black_24dp"
android:title="Item2"
/>
</group>
And when you add menu items to group1:
Menu menu = navigationView.getMenu();
menu.add(R.id.group1,Menu.NONE,Menu.NONE,itemName);
This should work. I tested it on Android design library 23.1.1.
answered Jan 20 '16 at 3:38
HexiseHexise
715714
715714
Menu has added but it's always added in top position, I can't add it in desire position. any Idea
– Hitesh Dhamshaniya
May 30 '17 at 5:56
@HiteshDhamshaniya you can still use order parameter in Menu.add() method. Larger order will be sorted in bottom.
– Hexise
Jul 11 '17 at 7:41
add a comment |
Menu has added but it's always added in top position, I can't add it in desire position. any Idea
– Hitesh Dhamshaniya
May 30 '17 at 5:56
@HiteshDhamshaniya you can still use order parameter in Menu.add() method. Larger order will be sorted in bottom.
– Hexise
Jul 11 '17 at 7:41
Menu has added but it's always added in top position, I can't add it in desire position. any Idea
– Hitesh Dhamshaniya
May 30 '17 at 5:56
Menu has added but it's always added in top position, I can't add it in desire position. any Idea
– Hitesh Dhamshaniya
May 30 '17 at 5:56
@HiteshDhamshaniya you can still use order parameter in Menu.add() method. Larger order will be sorted in bottom.
– Hexise
Jul 11 '17 at 7:41
@HiteshDhamshaniya you can still use order parameter in Menu.add() method. Larger order will be sorted in bottom.
– Hexise
Jul 11 '17 at 7:41
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f31722566%2fdynamic-adding-item-to-navigationview-in-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you see the source of drawer? If you change something in drawer, remember to invalidate it/reload
– deadfish
Jul 30 '15 at 12:29
Ofc, the problem is that I cannot add new item below Item2. When I call method addNewItem, new item doesn't appear in the first group above the separator, but at the bottom of the menu.
– Skye
Jul 30 '15 at 12:40
what about method
addHeaderView()
?– deadfish
Jul 30 '15 at 12:49
@Skye have you found a workaround for this? Am having the exact same problem.
– irobotxxx
Sep 24 '15 at 15:08
@manuelJ yes, when you have items with icons/images and when you try to add item dynamically, this item will be added below the current items. I also try custom libraries and it didnt work too. My solution is to write items into xml file, and after adding or deleting item (from xml file) drawer menu should be loaded again.
– Skye
Sep 24 '15 at 22:26