예제 #1
0
        private void AddFormulaItem()
        {
            LinearLayout ll = new LinearLayout(this)
            {
                WeightSum        = 2,
                LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };

            var lp = new TableLayout.LayoutParams(0, ViewGroup.LayoutParams.WrapContent)
            {
                Weight = 1
            };

            Spinner spSentenceItem = new Spinner(this)
            {
                LayoutParameters = lp
            };
            var adapter = new LObjectListAdapter(this, SentencePart.Instance.List.Values.ToArray());

            spSentenceItem.Adapter       = adapter;
            spSentenceItem.ItemSelected += SpSentenceItem_ItemSelected;
            ll.AddView(spSentenceItem);

            LinearLayout llFormulaItemList = FindViewById <LinearLayout>(Resource.Id.llFormulaItemList);

            llFormulaItemList.AddView(ll);
        }
예제 #2
0
        private void InitVerbAspect()
        {
            Spinner spVerbAspect = FindViewById <Spinner>(Resource.Id.spVerbAspect);

            spVerbAspect.ItemSelected += SpVerbAspect_ItemSelected;

            var adapter = new LObjectListAdapter(this, VerbAspect.Instance.List.Values.ToArray());

            spVerbAspect.Adapter = adapter;
        }
예제 #3
0
        private void SpSentenceItem_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            LinearLayout ll = (sender as Spinner).Parent as LinearLayout;

            if (e.Id == SentencePart.spModalVerb ||
                e.Id == SentencePart.spNotionalVerb)
            {
                if (ll.ChildCount == 1)
                {
                    var lp = new TableLayout.LayoutParams(0, ViewGroup.LayoutParams.WrapContent)
                    {
                        Weight = 1
                    };
                    Spinner spSentenceItemType = new Spinner(this)
                    {
                        LayoutParameters = lp
                    };
                    ll.AddView(spSentenceItemType);
                }

                BaseAdapter adapter;
                Spinner     sp = ll.GetChildAt(1) as Spinner;
                if (e.Id == SentencePart.spModalVerb)
                {
                    adapter = new LObjectListAdapter(this, ModalVerb.Instance.List.Values.ToArray());
                }
                else
                {
                    adapter = new LObjectListAdapter(this, NotionalVerb.Instance.List.Values.ToArray());
                }
                sp.Adapter = adapter;
            }
            else
            {
                if (ll.ChildCount == 2)
                {
                    ll.RemoveViewAt(1);
                }
            }
        }