android - Dynamically add items to NavigationView with loading gif -
i have navigation view (sidebar) looks this:
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:
- how can dynamically add new items sidebar under new subheader, below divider?
- 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
Post a Comment