public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ParseXML(); sampleLayout = new SampleLayout(MainActivity.context, aSamples); sampleLayout.NotifyDataSetChanged(); }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var mActionBar = ActionBar; mActionBar.SetDisplayHomeAsUpEnabled(true); mActionBar.SetDisplayShowCustomEnabled(true); mActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent))); mActionBar.SetDisplayShowTitleEnabled(false); LayoutInflater mInflater = LayoutInflater.From(this); View mCustomView = mInflater.Inflate(Resource.Layout.samplelist_layout, null); selectedGroup = (Group)MainActivity.SelectedIntent.GetSerializableExtra("sample"); SampleLayout sampleLayouts = new SampleLayout(MainActivity.context, selectedGroup.samples); mActionBar.CustomView = mCustomView; Sample selectedSample = (Sample)selectedGroup.samples[selectedIndex]; SetContentView(Resource.Layout.SamplePage); ImageView imageButton = (ImageView)mCustomView .FindViewById(Resource.Id.imageButton); Context wrapper = new ContextThemeWrapper(this, Android.Resource.Style.Theme); ListPopupWindow popupWindow = new ListPopupWindow(wrapper); popupWindow.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.listpopup)); imageButton.Click += (object sender, EventArgs e) => { popupWindow.Show(); }; popupWindow.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { Sample subSamples = (Sample)selectedGroup.samples[e.Position]; selectedIndex = e.Position; RefreshSample(subSamples); popupWindow.Dismiss(); }; RelativeLayout settingButton = (RelativeLayout)mCustomView .FindViewById(Resource.Id.settingsParent); settingButton.Click += (object sender, EventArgs e) => { onProperyWindowClick(); }; if (selectedGroup.samples.Count <= 1) { imageButton.Visibility = ViewStates.Invisible; } popupWindow.AnchorView = imageButton; popupWindow.Width = measureContentWidth(sampleLayouts); popupWindow.SetAdapter(sampleLayouts); RefreshSample(selectedSample); }