Exemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            //
            ExpandableListModel.GenerateData(ref ListData, this);
            ListView = (ExpandableListView)this.FindViewById <Android.Widget.ExpandableListView>(Resource.Id.apps);


            ListAdapter = new ExpandableListAdapter(this, ListData, ListView);
            ListView.SetAdapter(ListAdapter);

            ListView.SetOnGroupClickListener(this);
            ListView.SetOnChildClickListener(this);
            //

            DrawerLayout          drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close);

            drawer.AddDrawerListener(toggle);
            toggle.SyncState();

            NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.SetNavigationItemSelectedListener(this);
        }
        public static void GenerateData(ref ExpandableListModel[] ListData, Context context)
        {
            string apps = context.GetString(Resource.String.apps_header);

            ListData = new ExpandableListModel[1] {
                new ExpandableListModel(apps, new List <string>()
                {
                    context.GetString(Resource.String.youtube)
                })
            };
        }