android - Dynamically add items to NavigationView with loading gif -


i have navigation view (sidebar) looks this:

enter image description here

the first 4 items in list static (they never change). however, need dynamically add items sidebar (which fetched rest api) below divider in picture above. few questions:

  1. how can dynamically add new items sidebar under new subheader, below divider?
  2. while it's adding items, how can display loading (spinner) gif below divider notify user happening?

here navigationview activity:

<android.support.design.widget.navigationview     android:id="@+id/navigation_view"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_gravity="start"     android:background="@android:color/white"     app:menu="@menu/menu_drawer"     /> 

and here menu_drawer (with static items):

<menu xmlns:android="http://schemas.android.com/apk/res/android">     <group android:checkablebehavior="single">         <item             android:icon="@drawable/ic_first"             android:title="inbox"             android:checked="true"/>         <item             android:icon="@drawable/ic_second"             android:title="starred" />         <item             android:icon="@drawable/ic_third"             android:title="sent mail" />         <item             android:icon="@drawable/ic_fourth"             android:title="drafts" />     </group> </menu> 

look library built library drawer https://github.com/mikepenz/materialdrawer . or suggestion replace menu list view items , can add/remove list view dynamically


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -