• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ArrayAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ArrayAdapter的典型用法代码示例。如果您正苦于以下问题:C# ArrayAdapter类的具体用法?C# ArrayAdapter怎么用?C# ArrayAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArrayAdapter类属于命名空间,在下文中一共展示了ArrayAdapter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnCreate

		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

			items = new string[] { "Sessions", "Speakers", "About" };
			ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
		}
开发者ID:flolovebit,项目名称:xamarin-evolve-2014,代码行数:7,代码来源:MenuActivity.cs


示例2: OnActivityCreated

        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            var detailsFrame = Activity.FindViewById<View>(Resource.Id.details);

            // If running on a tablet, then the layout in Resources/Layout-Large will be loaded.
            // That layout uses fragments, and defines the detailsFrame. We use the visiblity of
            // detailsFrame as this distinguisher between tablet and phone.
            _isDualPane = detailsFrame != null && detailsFrame.Visibility == ViewStates.Visible;

            var adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, Shakespeare.Titles);
            ListAdapter = adapter;

            if (savedInstanceState != null)
            {
                _currentPlayId = savedInstanceState.GetInt("current_play_id", 0);
            }

            if (_isDualPane)
            {
                ListView.ChoiceMode = ChoiceMode.Single;
                ShowDetails(_currentPlayId);
            }
        }
开发者ID:peter-dangelo,项目名称:XamarinAndroidFragments,代码行数:25,代码来源:TitlesFragment.cs


示例3: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.ShareLocation);

            customDate = DateTime.Now;

            boxProgress = FindViewById<LinearLayout> (Resource.Id.boxProgress);
            boxProgress.Visibility = ViewStates.Gone;

            textDate = FindViewById<TextView> (Resource.Id.textDate);
            textDate.Visibility = ViewStates.Gone;

            spinnerTime = FindViewById<Spinner> (Resource.Id.spinnerTime);
            spinnerTime.ItemSelected += HandleItemSelected;
            arrayAdapter = ArrayAdapter.CreateFromResource (this, Resource.Array.expiration_time_array, Android.Resource.Layout.SimpleSpinnerItem);
            arrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerTime.Adapter = arrayAdapter;
            spinnerTime.SetSelection (defaultTimeIndex);
            selectedTime = timeValues [defaultTimeIndex];

            shareButton = FindViewById<Button> (Resource.Id.buttonShare);
            shareButton.Click += HandleShareClick;

            textDate.Click += delegate {
                ShowDialog (0);
            };
        }
开发者ID:slluis,项目名称:TrackMe,代码行数:29,代码来源:ShareLocationActivity.cs


示例4: MultiSelectionSpinner

 public MultiSelectionSpinner(Context c)
     : base(c, null)
 {
     context = c;
     simpleAdapter = new ArrayAdapter<string>(context, Android.Resource.Layout.SimpleSpinnerItem);
     Adapter = simpleAdapter;
 }
开发者ID:nodoid,项目名称:MultiSelectSpinner,代码行数:7,代码来源:MutliSelectionSpinner.cs


示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            Button startTest = FindViewById<Button>(Resource.Id.startTest);
            ListView listView = FindViewById<ListView>(Resource.Id.listView);

            startTest.Click += delegate
            {
                ArrayAdapter<string> adapter = new ArrayAdapter<string>(
                    this,
                    Android.Resource.Layout.SimpleListItem1,
                    Android.Resource.Id.Text1);
                listView.Adapter = adapter;

                OkHttpClient client = new OkHttpClient();

                // Create request for remote resource.
                Request request = new Request.Builder()
                    .Url(Endpoint)
                    .Build();

                // Execute the request and retrieve the response.
                WebSocketCall call = WebSocketCall.Create(client, request);
                WebSocketListener listener = call.Enqueue();

                // attach handlers to the various events
                listener.Close += (sender, e) =>
                {
                    RunOnUiThread(() => adapter.Add(string.Format("{0}: {1}", e.Code, e.Reason)));
                };
                listener.Failure += (sender, e) =>
                {
                    if (e.Exception != null)
                        RunOnUiThread(() => adapter.Add(e.Exception.Message));
                    else
                        RunOnUiThread(() => adapter.Add("Unknown Error!"));
                };
                listener.Message += (sender, e) =>
                {
                    string payload = e.Payload.String();
                    e.Payload.Close();
					RunOnUiThread(() => adapter.Add(string.Format("{0}\n{1}", payload, e.Payload.ContentType())));
                };
                listener.Open += (sender, e) =>
                {
                    RunOnUiThread(() => adapter.Add("Opened Web Socket."));

                    StartMessages(e.WebSocket);
                };
                listener.Pong += (sender, e) =>
                {
                    string payload = e.Payload.ReadString(Charset.DefaultCharset());
                    e.Payload.Close();
                    RunOnUiThread(() => adapter.Add(payload));
                };
            };
        }
开发者ID:Redth,项目名称:square-bindings,代码行数:60,代码来源:MainActivity.cs


示例6: OnCreate

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			// If this is a submenu list, this will have the prefix to get here
			var prefix = Intent.GetStringExtra ("com.example.android.apis.Path");

			// This must be the top-level menu list
			prefix = prefix ?? string.Empty;

			// Get the activities for this prefix
			var activities = GetDemoActivities (prefix);

			// Get the menu items we need to show
			var items = GetMenuItems (activities, prefix);

			// Add the menu items to the list
			ListAdapter = new ArrayAdapter<ActivityListItem> (this, AndroidR.Layout.SimpleListItem1, AndroidR.Id.Text1, items);

			// Launch the new activity when the list is clicked
			ListView.ItemClick += delegate (object sender, AdapterView.ItemClickEventArgs args) {
				var item = (ActivityListItem)(sender as ListView).GetItemAtPosition (args.Position);
				LaunchActivityItem (item);
			};
			
		}
开发者ID:wada811,项目名称:Xamarin.Android.ViewPagerIndicator,代码行数:26,代码来源:ViewPagerIndicator.cs


示例7: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            items = new string[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
            ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemChecked, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemSingleChoice, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemMultipleChoice, items);

            ListView lv = FindViewById<ListView>(Android.Resource.Id.List);

			// For targeting Gingerbread the ChoiceMode is an int, otherwise it is an
			// enumeration.
			 
            lv.ChoiceMode = Android.Widget.ChoiceMode.Single; // 1
            //lv.ChoiceMode = Android.Widget.ChoiceMode.Multiple; // 2
            //lv.ChoiceMode = Android.Widget.ChoiceMode.None; // 0

			// Use this block if targeting Gingerbread or Lower
			/*
			lv.ChoiceMode = Android.Widget.ChoiceMode.Single; // Single
            //lv.ChoiceMode = 0; // none
            //lv.ChoiceMode = 2; // Multiple
            //lv.ChoiceMode = 3; // MultipleModal
			*/

            // Set the initially checked row ("Fruits")
            lv.SetItemChecked(1, true);

            // Set another initially checked row ("Bulbs") IF multiple selection allowed
            lv.SetItemChecked(4, true);
        }
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:32,代码来源:HomeScreen.cs


示例8: OnCreate

        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            var client = new Client("Android");

            var input = FindViewById<EditText>(Resource.Id.Input);
            var messages = FindViewById<ListView>(Resource.Id.Messages);

            var inputManager = (InputMethodManager)GetSystemService(InputMethodService);
            var adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, new List<string>());

            messages.Adapter = adapter;

            await client.Connect();

            input.EditorAction +=
              delegate
              {
                  inputManager.HideSoftInputFromWindow(input.WindowToken, HideSoftInputFlags.None);

                  if (string.IsNullOrEmpty(input.Text))
                      return;

                  client.Send(input.Text);

                  input.Text = "";
              };

            client.OnMessageReceived +=
              (sender, message) => RunOnUiThread(() =>
                adapter.Add(message));
        }
开发者ID:jcambert,项目名称:MVA-SignalR,代码行数:35,代码来源:MainActivity.cs


示例9: OnCreate

 //ListView mainListView ;
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate (bundle);
        			SetContentView (Resource.Layout.Books);
     items = new string[] { "Vegetables","Fruits","Flower Buds","Legumes","Bulbs","Tubers" };
     ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
 }
开发者ID:Intechnovation,项目名称:DesiDhwani2,代码行数:8,代码来源:BooksActivity.cs


示例10: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            Assembly asm = Assembly.GetExecutingAssembly();
            Stream pdfStream = asm.GetManifestResourceStream("PDFToImage.xfinium.pdf");
            document = new PdfFixedDocument (pdfStream);
            pdfStream.Close();

            Spinner pageNumbers = FindViewById<Spinner>(Resource.Id.pageNumberSpinner);
            ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
            pageNumbers.Adapter = adapter;
            adapter.Add("Please select a page number");
            for (int i = 1; i <= document.Pages.Count; i++)
            {
                adapter.Add(i.ToString());
            }
            Button button = FindViewById<Button> (Resource.Id.btnConvertToImage);

            button.Click += delegate {
                if ((pageNumbers.SelectedItemPosition >= 1) && (pageNumbers.SelectedItemPosition <= document.Pages.Count))
                {
                    PdfPageRenderer renderer = new PdfPageRenderer (document.Pages [pageNumbers.SelectedItemPosition - 1]);
                    Bitmap pageImage = renderer.ConvertPageToImage (96);

                    ImageView pageImageView = FindViewById<ImageView> (Resource.Id.pageImageView);
                    pageImageView.SetImageBitmap(pageImage);
                }
            };
        }
开发者ID:baitun,项目名称:BGUEP-Journal,代码行数:33,代码来源:MainActivity.cs


示例11: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            items = new string[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
            ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemChecked, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemSingleChoice, items);
            //ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItemMultipleChoice, items);

            ListView lv = FindViewById<ListView>(Android.Resource.Id.List);
#if __ANDROID_11__
            lv.ChoiceMode = Android.Widget.ChoiceMode.Single; // 1
            //lv.ChoiceMode = Android.Widget.ChoiceMode.Multiple; // 2
            //lv.ChoiceMode = Android.Widget.ChoiceMode.None; // 0
#else
            lv.ChoiceMode = 1; // Single
            //lv.ChoiceMode = 0; // none
            //lv.ChoiceMode = 2; // Multiple
            //lv.ChoiceMode = 3; // MultipleModal
#endif
            // Set the initially checked row ("Fruits")
            lv.SetItemChecked(1, true);

            // Set another initially checked row ("Bulbs") IF multiple selection allowed
            lv.SetItemChecked(4, true);
        }
开发者ID:RafasTavares,项目名称:monodroid-samples,代码行数:26,代码来源:HomeScreen.cs


示例12: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            var phoneNumbers = Intent.Extras.GetStringArrayList("phone_numbers") ?? new string[0];
            ListAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleExpandableListItem1, phoneNumbers);
        }
开发者ID:CubicleJockey,项目名称:Xarmin,代码行数:7,代码来源:CallHistoryActivity.cs


示例13: SetupBankViews

        private void SetupBankViews(View parent)
        {
            var banksSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank);
            var banksBranchSpinner = parent.FindViewById<Spinner>(Resource.Id.payment_bank_branch);

            var banks = bankRepository.GetAll().ToList();
            var bankNames = banks.Select(b => b.Name).ToList();
            var banksAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item, bankNames);
            banksSpinner.Adapter = banksAdapter;

            var bankBranchesAdapter = new ArrayAdapter(Activity, Resource.Layout.bank_spinner_item);
            banksBranchSpinner.Adapter = bankBranchesAdapter;

            banksSpinner.ItemSelected += delegate
            {
                this.bank = banks[banksSpinner.SelectedItemPosition];

                var bankBranchNames = bank.Branches.Select(b => b.Name).ToList();
                bankBranchesAdapter.Clear();
                bankBranchesAdapter.AddAll(bankBranchNames);

                banksBranchSpinner.ItemSelected += delegate
                {
                    this.bankBranch = bank.Branches[banksBranchSpinner.SelectedItemPosition];
                };
            };

            bank = banks.First();
            bankBranch = bank.Branches.First();
        }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:30,代码来源:ReceiveChequePaymentFragment.cs


示例14: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "accueil" layout resource
            SetContentView(Resource.Layout.GroupManager);

            //Vue qui va contenir la liste des groupes de l'utilisateur
            ListView lv = FindViewById<ListView>(Resource.Id.List);
            lv.ChoiceMode = ChoiceMode.Single;  //On ne peut selectionné qu'un item
            
            //On remplit la liste items avec les noms de groupes du user

            foreach (Group grp in users_db[1].groups)
            {
                items.Add(grp.groupName);
            }

            //on remplit le ListView avec la liste items
            ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItemActivated1, items);
            lv.Adapter = adapter;
            
            lv.ItemClick += OnListItemClick;

        }
开发者ID:hesrondev,项目名称:TeamEventApp,代码行数:25,代码来源:GroupManagerActivity.cs


示例15: EndlessScrollListener

 public EndlessScrollListener(ArrayAdapter<DateTime> adapter)
 {
     this.adapter = adapter;
     for (int i = 0; i < chunksize*2; i++) {
         adapter.Add (DateTime.Now.AddDays (i));
     };
 }
开发者ID:naturalistic,项目名称:DroidInfiniteTable,代码行数:7,代码来源:InfiniteListActivity.cs


示例16: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            items = new string[] { "DrawerLayout","SlidingPaneLayout"};
            ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
        }
开发者ID:bopang,项目名称:monodroid-samples,代码行数:7,代码来源:MainActivity.cs


示例17: OnCreate

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            beaconManager = new BeaconManager(this);
            beaconManager.Eddystone += (sender, e) => 
                {
                    if(e.Eddystones.Count == 0)
                        return;

                    RunOnUiThread(()=>
                        {
                            var items = e.Eddystones.Select(n => "Url: " + n.Url + "Proximity: " + Utils.ComputeProximity(n));
                            ListAdapter = new ArrayAdapter<string>(this, 
                                Android.Resource.Layout.SimpleListItem1, 
                                Android.Resource.Id.Text1, 
                                items.ToArray());



                            ActionBar.Subtitle = string.Format("Found {0} eddystones.", items.Count());
                        });


                };



        }
开发者ID:Chepeman,项目名称:BeaconScanner,代码行数:30,代码来源:EddystoneActivity.cs


示例18: OnCreate

        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            if (!IsConnectedToService())
            {
                throw new Exception("cant connect to service");
            }

            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            ListView carListView = FindViewById<ListView>(Resource.Id.carlistView);

            List<string> cars = (await _client.GetAllAsync()).Select(x=>x.Model).ToList();

            _adapter = new ArrayAdapter(
                this,
                Android.Resource.Layout.SimpleListItem1,
                cars);

            carListView.Adapter = _adapter;
        }
开发者ID:bilal-fazlani,项目名称:WebService,代码行数:25,代码来源:MainActivity.cs


示例19: OnCreate

        // NOTE: subclasses MapActivity (and implement IsRouteDisplayed)
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.AutoCompleteTextView);

            AutoCompleteTextView act = FindViewById<AutoCompleteTextView>(Resource.Id.AutoCompleteInput);

            Stream seedDataStream = Assets.Open(@"WordList.txt");
            //StreamReader reader = new StreamReader(seedDataStream);

            List<string> lines = new List<string>();
            using (StreamReader reader = new StreamReader(seedDataStream)) {
                // 3
                // Use while != null pattern for loop
                string line;
                while ((line = reader.ReadLine()) != null) {
                    // 4
                    // Insert logic here.
                    // ...
                    // "line" is a line in the file. Add it to our List.
                    lines.Add(line);
                }
            }

            string[] wordlist = lines.ToArray();

            ArrayAdapter arr = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, wordlist);
            act.Adapter = arr;
        }
开发者ID:bholmes,项目名称:monodroid-samples,代码行数:31,代码来源:AutoCompleteTextViewScreen.cs


示例20: UpdateArtistsList

        public void UpdateArtistsList()
        {
            list = model.Songs.Select (s => s.Artist).Distinct ().OrderBy (s => s).Select (s => new String (s)).ToArray ();

            var adapter = new ArrayAdapter<String> (this, Android.Resource.Layout.SimpleListItem1, list);
            this.ListAdapter = adapter;
        }
开发者ID:atsushieno,项目名称:tiny-google-music-client,代码行数:7,代码来源:ArtistsActivity.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ArrayBuilder类代码示例发布时间:2022-05-24
下一篇:
C# Array类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap