Esempio n. 1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            SwipeMenuLayout layout = null;

            if (convertView == null)
            {
                View      contentView = mAdapter.GetView(position, convertView, parent);
                SwipeMenu menu        = new SwipeMenu(mContext);
                menu.ViewType = mAdapter.GetItemViewType(position);
                CreateMenu(menu);
                PullToRefresharp.Android.Widget.ListView listview = (PullToRefresharp.Android.Widget.ListView)parent;
                SwipeMenuView menuView = new SwipeMenuView(menu, listview);
                menuView.ItemClickListener = this;
                layout = new SwipeMenuLayout(contentView, menuView,
                                             listview.CloseInterpolator,
                                             listview.OpenInterpolator);
                layout.Position = position;
            }
            else
            {
                layout = (SwipeMenuLayout)convertView;
                layout.CloseMenu();
                layout.Position = position;
                View view = mAdapter.GetView(position, layout.ContentView, parent);
            }
            return(layout);
        }
Esempio n. 2
0
        public SwipeMenuView(SwipeMenu menu, PullToRefresharp.Android.Widget.ListView listView)
            : base(menu.Context)
        {
            mListView = listView;
            mMenu     = menu;
            int id = 0;

            foreach (SwipeMenuItem item in menu.GetMenuItems())
            {
                AddItem(item, id++);
            }
        }
Esempio n. 3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var theView = inflater.Inflate(Resource.Layout.GalaxyPopLayout, container, false);

            xField     = theView.FindViewById <EditText>(Resource.Id.xField);
            yField     = theView.FindViewById <EditText>(Resource.Id.yField);
            zField     = theView.FindViewById <EditText>(Resource.Id.zField);
            header     = theView.FindViewById <TextView>(Resource.Id.header);
            systemList = theView.FindViewById <PullToRefresharp.Android.Widget.ListView>(Resource.Id.systemList);

            systemList.RefreshActivated += SystemList_RefreshActivated;
            return(theView);
        }
Esempio n. 4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View theView = inflater.Inflate(Resource.Layout.SolSysPopLayout, container, false);

            titleText       = theView.FindViewById <TextView>(Resource.Id.SolSysTitle);
            coordText       = theView.FindViewById <TextView>(Resource.Id.solSysCoord);
            planetCountText = theView.FindViewById <TextView>(Resource.Id.planetCount);
            planetList      = theView.FindViewById <PullToRefresharp.Android.Widget.ListView>(Resource.Id.planetList);

            titleText.SetTypeface(MainActivity.titleFace, TypefaceStyle.Normal);
            coordText.SetTypeface(MainActivity.titleFace, TypefaceStyle.Normal);
            planetCountText.SetTypeface(MainActivity.titleFace, TypefaceStyle.Normal);

            planetList.RefreshActivated += (o, e) =>
            {
                RefreshFromData(true);
            };


            return(theView);
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle bundle)
        {
            //TabLayoutResource = Resource.Layout.Tabbar;
            //ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            #region  拉列表显示效果

            mainActivity = this;

            SetContentView(Resource.Layout.main);

            PullToRefresharp.Android.Widget.ListView lv = (PullToRefresharp.Android.Widget.ListView)FindViewById(Resource.Id.myGridView1);
            //lv.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, ITEMS);

            List <Students> studentsList = new List <Students>();
            for (int i = 0; i < 10; i++)
            {
                Students stu = new Students
                {
                    photo = "user.png",
                    name  = "name" + i,
                    age   = 10 + i,
                    //sex = item.sex,
                };
                studentsList.Add(stu);
            }
            lv.Adapter = new MyAdapter(studentsList, Android.App.Application.Context);


            lv.RefreshActivated += (e, s) =>
            {
                Task.Delay(1000).ContinueWith((t) =>
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        lv.OnRefreshCompleted();
                    });
                });
            };

            lv.SetMenuCreator(new LvSwipeMenuCreator());

            lv.SetOnMenuItemClickListener(new LvMenuItemClickListener());

            LvSwipeListener swipeListener = new LvSwipeListener();

            lv.SetOnSwipeListener(swipeListener);
            #endregion

            #region 自定义adapater
            //ListView lv = new ListView(this);
            //lv.Adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, ITEMS);

            #endregion

            #region com.Swipelistview
            //SetContentView(Resource.Layout.activity_main);
            //Com.Fortysevendeg.Swipelistview.SwipeListView lv = (Com.Fortysevendeg.Swipelistview.SwipeListView)FindViewById(Resource.Id.example_lv_list);
            //lv.Adapter= new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, ITEMS);

            #endregion

            //LoadApplication(new App());
        }