First of all, my final goal is to dynamically create a hamburger menu for an android app. The hamburger menu needs to have main menu items, that each have a set of sub menu items.
However, before I get there I'm simply trying to create a simple listview display of the menu items. Each menu items contain a string (label) and list of string (label) / guid combinations.
I have my ViewModel containing the following:
public MvxObservableCollection<MenuItem> MenuItems { get; private set; }
public class MenuItem
{
public MenuItem(string title)
{
Title = title;
}
public string Title { get; private set; }
}
My View axml definition looks like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/toolbar_layout">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
local:layout_scrollFlags="scroll|enterAlways" />
</android.support.design.widget.AppBarLayout>
<Mvx.MvxListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
local:MvxItemTemplate="@layout/listitem_mainmenu"
local:MvxBind="ItemsSource MenuItems" />
</RelativeLayout>
The listitem_mainmenu.axml definition looks like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20dp"
local:MvxBind="Text Title; Click ShowDashboard" />
</LinearLayout>
I've debugged and verified that my MenuItems collection does contain 8 items. However, when the display is presented nothing is displayed in the emulation device.
Any suggestions on: 1) getting this list of items to show up, and 2) ultimately converting this to a hamburger menu would be appreciated.