当前位置: 首页>>代码示例>>C#>>正文


C# GridView.SetAdapter方法代码示例

本文整理汇总了C#中GridView.SetAdapter方法的典型用法代码示例。如果您正苦于以下问题:C# GridView.SetAdapter方法的具体用法?C# GridView.SetAdapter怎么用?C# GridView.SetAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GridView的用法示例。


在下文中一共展示了GridView.SetAdapter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnViewCreated

        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            grid = (GridView)view.FindViewById(Resource.Id.asset_grid);
            grid.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {

            };

            string[] array = { "Afghanistan","Albania","Algeria","Andorra","Angola","Antigua & Barbuda","Argentina","Armenia","Australia","Austria","Azerbaijan",
            "Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bhutan","Bolivia","Bosnia and Herzegovina","Botswana","Brazil","Brunei","Bulgaria","Burkina Faso","Burma","Burundi",
            "Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo, Democratic Republic of the","Congo, Republic of the","Costa Rica","Cote d\'voire","Croatia","Cuba","Cyprus","Czech Republic",
            "Denmark","Djibouti","Dominica","Dominican Republic",
            "Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia",
            "Fiji","Finland","France",
            "Gabon","Gambia, The","Georgia","Ghana","Greece","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana",
            "Haiti","Holy See","Honduras","Hong Kong","Hungary",
            "Iceland","India","Indonesia","Iran","Iraq","Ireland","Israel","Italy",
            "Jamaica","Japan","Jordan",
            "Kazakhstan","Kenya","Kiribati","Korea, North","Korea, South","Kosovo","Kuwait","Kyrgyzstan",
            "Laos","Latvia","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Lithuania","Luxembourg",
            "Macau","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia","Moldova","Monaco","Mongolia","Montenegro","Morocco","Mozambique",
            "Namibia","Nauru","Nepal","Netherlands","Netherlands Antilles","New Zealand","Nicaragua","Niger","Nigeria","North Korea","Norway",
            "Oman",
            "Pakistan","Palau","Palestinian Territories","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Poland","Portugal",
            "Qatar",
            "Romania","Russia","Rwanda",
            "Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines","Samoa","San Marino","Sao Tome and Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","South Africa","South Korea","South Sudan","Spain","Sri Lanka","Sudan","Suriname","Swaziland","Sweden","Switzerland","Syria",
            "Taiwan","Tajikistan","Tanzania","Thailand ","Timor-Leste","Togo","Tonga","Trinidad and Tobago","Tunisia","Turkey","Turkmenistan","Tuvalu",
            "Uganda","Ukraine","United Arab Emirates","United Kingdom","Uruguay","Uzbekistan",
            "Vanuatu","Venezuela","Vietnam",
            "Yemen",
            "Zambia","Zimbabwe", };

            grid.SetAdapter(new StickyGridHeadersSimpleArrayAdapter(Activity, array, Resource.Layout.GridHeader, Resource.Layout.GridItem));

            ((StickyGridHeadersGridView)grid).SetOnHeaderClickListener(this);
            ((StickyGridHeadersGridView)grid).SetOnHeaderLongClickListener(this);

            SetHasOptionsMenu(true);
        }
开发者ID:GuyMicciche,项目名称:SuperNWTBible,代码行数:42,代码来源:CanonGridFragment.cs

示例2: OnCreateView

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            float density = Resources.DisplayMetrics.Density;
            if (density == 3) density = 2;

            //Console.WriteLine("MLBFragment - OnCreateView");
            _view = inflater.Inflate(Resource.Layout.MobileLibraryBrowser, container, false);

            // Get screen size
            Point size = new Point();
            Activity.WindowManager.DefaultDisplay.GetSize(size);

            // Create bitmap cache
            int maxMemory = (int)(Runtime.GetRuntime().MaxMemory() / 1024);
            BitmapCache = new BitmapCache(Activity, maxMemory / 8, size.X / 2, size.X / 2); // Max size = half the screen (grid has 2 columns)
            SmallBitmapCache = new BitmapCache(Activity, maxMemory / 16, 44 * (int)density, 44 * (int)density);

            _viewFlipper = _view.FindViewById<ViewFlipper>(Resource.Id.mobileLibraryBrowser_viewFlipper);            
            _imageAlbum = _view.FindViewById<SquareImageView>(Resource.Id.mobileLibraryBrowser_imageAlbum);
            _lblBreadcrumb = _view.FindViewById<TextView>(Resource.Id.mobileLibraryBrowser_lblBreadcrumb);
            _layoutAlbum = _view.FindViewById<LinearLayout>(Resource.Id.mobileLibraryBrowser_layoutAlbum);
            _layoutSongs = _view.FindViewById<LinearLayout>(Resource.Id.mobileLibraryBrowser_layoutSongs);
            _lblArtistName = _view.FindViewById<TextView>(Resource.Id.mobileLibraryBrowser_lblArtistName);
            _lblAlbumTitle = _view.FindViewById<TextView>(Resource.Id.mobileLibraryBrowser_lblAlbumTitle);
            _lblAlbumLength = _view.FindViewById<TextView>(Resource.Id.mobileLibraryBrowser_lblAlbumLength);
            _lblAlbumSongCount = _view.FindViewById<TextView>(Resource.Id.mobileLibraryBrowser_lblAlbumSongCount);
            _listViewArtists = _view.FindViewById<ListView>(Resource.Id.mobileLibraryBrowser_listViewArtists);
            _listViewSongs = _view.FindViewById<ListView>(Resource.Id.mobileLibraryBrowser_listViewSongs);
            _listViewPlaylists = _view.FindViewById<ListView>(Resource.Id.mobileLibraryBrowser_listViewPlaylists);
            _gridViewAlbums = _view.FindViewById<GridView>(Resource.Id.mobileLibraryBrowser_gridViewAlbums);

            _listAdapterArtists = new MobileLibraryBrowserListAdapter(Activity, this, _listViewArtists, _entities.ToList());
            _listViewArtists.SetAdapter(_listAdapterArtists);
            _listViewArtists.ItemClick += ListViewOnItemClick;
            _listViewArtists.ItemLongClick += ListViewOnItemLongClick;

            _listAdapterSongs = new MobileLibraryBrowserListAdapter(Activity, this, _listViewSongs, _entities.ToList());
            _listViewSongs.SetAdapter(_listAdapterSongs);
            _listViewSongs.ItemClick += ListViewOnItemClick;
            _listViewSongs.ItemLongClick += ListViewOnItemLongClick;

            _gridAdapter = new MobileLibraryBrowserGridAdapter(Activity, this, _gridViewAlbums, _entities.ToList());
            _gridViewAlbums.SetAdapter(_gridAdapter);
            _gridViewAlbums.ItemClick += GridViewOnItemClick;
            _gridViewAlbums.ItemLongClick += GridViewOnItemLongClick;

            var navigationManager = (AndroidNavigationManager)Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            navigationManager.BindMobileLibraryBrowserView(this, _tabType, _browserType, _query);

            return _view;
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:51,代码来源:MobileLibraryBrowserFragment.cs


注:本文中的GridView.SetAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。