[{"data":1,"prerenderedAt":639},["ShallowReactive",2],{"article-xamarin-android-drawerlayout":3},{"article":4,"tags":280,"previous":295,"next":583},{"id":5,"title":6,"author":7,"body":8,"createdAt":269,"description":270,"extension":271,"img":66,"meta":272,"navigation":273,"path":274,"seo":275,"stem":276,"tags":277,"updatedAt":269,"__hash__":279},"articles\u002Farticles\u002Fxamarin-android-drawerlayout.md","Xamarin Android - DrawerLayout","[object Object]",{"type":9,"value":10,"toc":265},"minimark",[11,122,167,206],[12,13,14,15,20,21,23,24,27,28,31,35,36,38,39,41,42,44,45,47,48,50,51,56,57,59,71,73,74,76,77,79,80,83,84,86,87,89,90,92,100,101,109,111,112,114,115,117,118,121],"p",{},"To add a navigation drawer, declare your user interface with a ",[16,17,19],"a",{"href":18},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv4\u002Fwidget\u002FDrawerLayout.html","DrawerLayout"," object as the root view of your layout. Inside the ",[16,22,19],{"href":18},", add one view that contains the main content for the screen (your primary layout when the drawer is hidden) and another view that contains the contents of the navigation drawer.",[25,26],"br",{},"\n\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003Candroid.support.v4.widget.DrawerLayout\nxmlns:android=\"",[16,29],{"href":30},"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid",[16,32,30],{"href":30,"rel":33},[34],"nofollow","\"\nandroid:id=\"@+id\u002FdrawerLayout\"\n   android:layout_width =\"match_parent\"\n    android:layout_height=\"match_parent\">",[25,37],{},"\n  \u003C!-- Content -->\n  \u003CFrameLayout\n        android:id =\"@+id\u002FframeLayout\"\n        android:layout_width =\"match_parent\"\n        android:layout_height=\"match_parent\" \u002F>",[25,40],{},"\n  \u003C!-- Navigation drawer menu -->\n  \u003CListView\n        android:id=\"@+id\u002FdrawerListView\"\n        android:layout_gravity=\"start\"\n        android:choiceMode    =\"singleChoice\"\n        android:layout_width  =\"240dp\"\n        android:layout_height =\"match_parent\"\n        android:background =\"?android:attr\u002FwindowBackground\" \u002F>",[25,43],{},"\n\u003C\u002Fandroid.support.v4.widget.DrawerLayout>",[25,46],{},"\nThe above layout uses a DrawerLayout with two child views: a FrameLayout to contain the main content which will be populated with a Fragment at runtime, and a ListView for the contents of the drawer.",[25,49],{},"\nNow to the MainActivity.cs coding.. let’s get a reference to the drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);  You will find that DrawerLayout is not defined.  You need to add a reference via Nuget to ",[16,52,55],{"href":53,"target":54},"https:\u002F\u002Fcomponents.xamarin.com\u002Fview\u002Fxamandroidsupportv4-18","_blank","Android Support Library v4",".  Open Nuget and search for Xamarin.android.support.v4",[25,58],{},[16,60,62],{"href":61},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_2.png",[63,64],"img",{"style":65,"src":66,"border":67,"alt":68,"title":68,"width":69,"height":70},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;","\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb.png",0,"image",374,106,[25,72],{},"\nAndroid Support Libraries : The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.  Including the Support Libraries in your Android project is considered a best practice for application developers.",[25,75],{},"\nAdding a using statement for Android.Support.V4.Widget will complete the reference to DrawerLayout.",[25,78],{},"\n_menuItems = new string",[81,82],"span",{}," { \"Welcome\", \"Options\", \"About\" };\n_drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);\n_drawerList = FindViewById\u003CListView>(Resource.Id.drawerListView);\n_drawerList.Adapter = new ArrayAdapter\u003Cstring>(this, Resource.Layout.ListViewMenuRow, Resource.Id.menuRowTextView, _menuItems);",[25,85],{},"\nWe have a List which should be populated by an Adapter (ArrayAdapter or SimplerCursorAdaptor)",[25,88],{},"\nAt this point we have (left) and if you swipe toward the right you see the menu.",[25,91],{},[16,93,95],{"href":94},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_4.png",[63,96],{"style":65,"src":97,"border":67,"alt":68,"title":68,"width":98,"height":99},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_1.png",151,240," ",[16,102,104],{"href":103},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_6.png",[63,105],{"style":106,"src":107,"border":67,"alt":68,"title":68,"width":98,"height":108},"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;","\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_2.png",244,[25,110],{},"\nHooking up the menu click looks like..",[25,113],{},"\n_drawerList.ItemClick += _drawerList_ItemClick;",[25,116],{},"\nprivate void _drawerList_ItemClick(object sender, AdapterView.ItemClickEventArgs e)\n{\n    OnMenuItemClick(e.Position);\n}private void OnMenuItemClick(int position)\n{\n    this.Title = _menuItems",[81,119,120],{},"position",";\n}",[12,123,124,125,127,128,121,130,132,133,137,138,142,143,147,148,152,154,155,157,158,160,161,163,164,166],{},"If you want to use lambda the above can be rewritten..",[25,126],{},"\n_drawerList.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => OnMenuItemClick(e.Position);\nprivate void OnMenuItemClick(int position)\n{\n    this.Title = _menuItems",[81,129,120],{},[25,131],{},"\nNow we have to deal with showing a view after clicking a menu item.  We will do this implementation with Fragments.  A Fragment is a piece of an application's user interface or behavior that can be placed in an ",[16,134,136],{"href":135},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FActivity.html","Activity",". Interaction with fragments is done through ",[16,139,141],{"href":140},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FFragmentManager.html","FragmentManager",", which can be obtained via ",[16,144,146],{"href":145},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FActivity.html#getFragmentManager()","Activity.getFragmentManager()"," and ",[16,149,151],{"href":150},"http:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fapp\u002FFragment.html#getFragmentManager()","Fragment.getFragmentManager()",[25,153],{},"\nAt this point, we declare field parameter Fragment",[81,156],{}," _fragments\nprivate Fragment",[81,159],{}," _fragments = new Fragment",[81,162],{},"{ new WelcomeFragment(), new OptionsFragment(), new AboutFragment() };",[25,165],{},"\nand within the menu click, use the FragmentManager to set the selected fragment using the position in the array.",[12,168,169,170,172,173,175,176,178,179,181,182,184,185,189,190,192,193,195,203,205],{},"private void OnMenuItemClick(int position)\n{\n    base.FragmentManager.BeginTransaction().Replace(Resource.Id.frameLayout, _fragments",[81,171,120],{},").Commit();\n    this.Title = _menuItems",[81,174,120],{},";\n}\nOk, so running the sample now we have a drawer menu, and when an item is selected we use FragmentManager to swap out the frameLayout view with a fragment defined in the _fragments array.  As the application starts we want to set the first menu item selected and we want to show the respective fragment via",[25,177],{},"\n_drawerList.SetItemChecked(0, true); \u002F\u002Fhighlight the first item at startup\nOnMenuItemClick(0);",[25,180],{},"\nAfter the menu item is selected, we swap fragments and we will also close the drawer via\n_drawerLayout.CloseDrawer(_drawerList);",[25,183],{},"\nIf you review the screen captures above you will notice we do not yet have the hamburger menu.  We will do this by working with the ActionBar.  Using the class ",[16,186,188],{"href":187,"target":54},"http:\u002F\u002Fdeveloper.xamarin.com\u002Fapi\u002Ftype\u002FAndroid.Support.V4.App.ActionBarDrawerToggle\u002F","ActionBarDrawerToggle"," we can tie together the functionality of DrawerLayout and the framework ActionBar to implement the recommended design for navigation drawers.",[25,191],{},"\nSo, I did have a few conflicts at this point which brings up Android.Support.V7.App vs. Android.Support.V4.App.  What is the difference? V4 supports library is designed to be used with Android 1.6 (API level 4) while V7 supports “libraries designed to be used with Android 2.1 (API level 7) and higher”  We will need to add via Nuget Xamarin.Android.Support.v7.AppCompat to reference ActionBarDrawerToggle.  i.e. Android.Support.V7.App.ActionBarDrawerToggle",[25,194],{},[16,196,198],{"href":197},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_8.png",[63,199],{"style":65,"src":200,"border":67,"alt":68,"title":68,"width":201,"height":202},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_3.png",342,100,[25,204],{},"\nWithin v7 Support Library there are several libraries with a number of feature sets which can be included independently of each other.  For example within v7 we have v7 appcompat library, v7 cardview library, v7 gridlayout library etc.",[12,207,208,209,211,212,216,217,219,220,222,223,227,228,230,231,219,233,235,100,242,250,252,253,255,256,258,259,261,262,264],{},"\u002F\u002Fcreate an instance of actionbardrawertoggle           \n_drawerToggle = new ActionBarDrawerToggle(this, _drawerLayout, Resource.String.DrawerOpenDescription, Resource.String.DrawerCloseDescription);\n\u002F\u002Fset the actiondrawertoggle as the drawerlistener on the drawlayout so it recieves drawer state-change callbacks\n_drawerLayout.SetDrawerListener(_drawerToggle);\n\u002F\u002FMust up-enable the home button, the ActionBarDrawerToggle will change the icon to the \"hamburger\"\nActionBar.SetDisplayHomeAsUpEnabled(true);",[25,210],{},"\nBuilding the project I do have an issue….”",[213,214,215],"strong",{},"No resource identifier found for attribute ‘touchscreenBlocksFocus’ in the package ‘android’ ","After more than 1 hour of searching I came along the solution.  I had ‘Compile using Android version:’ API Level 19, Minimum Android to target: Use Compile using SDK Version, Target Android: ‘'Use Compile Using SDK Version.  In order to avoid this error I had to change my Target Android version to API Level 21 (Xamarin.Android v5.0 Support).",[25,218],{},"\n ",[25,221],{},"\nSo that brings up the question\u002Fconcern, for Android applications you have the choices Compile Using, Minimum Android to target, and Target Android version.  So what is the difference here.  From ",[16,224,226],{"href":225,"target":54},"http:\u002F\u002Fstackoverflow.com\u002Fquestions\u002F4568267\u002Fandroid-min-sdk-version-vs-target-sdk-version\u002F4994039#4994039","StackOverflow"," a very good explanation (partial)\n”In short, here is the purpose to declaring a different targetSDK from the minSDK: It means you are using features from a higher level SDK than your minimum, but you have ensured backwards compatibility. In other words, imagine that you want to use a feature that was only recently introduced, but that isn't critical to your application. You would then set the targetSDK to the version where this new feature was introduced and the minimum to something lower so that everyone could still use your app.”",[25,229],{},"\nGetting back on track, we were hooking up the action bar to that of the drawer. Before we hook up this action bar drawer toggle we have this (left) notice there is no icon.  After we hook up the drawertoggle we have the \u003C icon.",[25,232],{},[25,234],{},[16,236,238],{"href":237},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_14.png",[63,239],{"style":65,"src":240,"border":67,"alt":68,"title":68,"width":241,"height":99},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_6.png",150,[16,243,245],{"href":244},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_10.png",[63,246],{"style":65,"src":247,"border":67,"alt":68,"title":68,"width":248,"height":249},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarinandroiddrawerlayout_9d2d-image_thumb_4.png",152,242,[25,251],{},"\nNow when a user clicks on the > icon we want to forward all actionbar clicks to the ActionBarDrawerToggle.  We can do this with",[25,254],{},"\npublic override bool OnOptionsItemSelected(IMenuItem item)\n{\n    \u002F\u002F Forward all ActionBar-clicks to the ActionBarDrawerToggle.\n    \u002F\u002F It will verify the click was on the \"Home\" button (i.e. the button at the left edge of the ActionBar).\n    \u002F\u002F If so, it will toggle the state of the drawer. It will then return \"true\" so you know you do not need to do any more processing.\n    if (_drawerToggle.OnOptionsItemSelected(item))\n        return true;\n    \u002F\u002F Other cases go here for other buttons in the ActionBar.\n    \u002F\u002F This sample app has no other buttons. This code is a placeholder to show what would be needed if there were other buttons.\n    switch (item.ItemId)\n    {\n        default: break;\n    }    return base.OnOptionsItemSelected(item);\n}",[25,257],{},"\nThe final piece of this is ensuring that the hamburger is shown when the menu is closed.  In order to do this we need to sync the state of the drawer via the following method.  This will execute after your activities initialization is finished.  You need to tell the toggle button to synchronize its icon with the open\u002Fclosed state of the drawer.",[25,260],{},"\nprotected override void OnPostCreate(Bundle savedInstanceState)\n{\n    \u002F\u002F Initialization and any needed Restore operation are now complete.\n    \u002F\u002F Sync the state of the ActionBarDrawerToggle to the drawer (i.e. show the \"hamburger\" if the drawer is closed or an arrow if it is open).\n     _drawerToggle.SyncState();\n    base.OnPostCreate(savedInstanceState);\n}",[25,263],{},"\nIf you would like the sample code, please connect with me via email or twitter and I will send to you.",{"title":266,"searchDepth":267,"depth":267,"links":268},"",2,[],"2016-01-30T08:45:55.4700000-05:00","To add a navigation drawer, declare your user interface with a DrawerLayout object as the root view of your layout. Inside the DrawerLayout, add one view that contains the main content for the screen (your primary layout when the drawer is hidden) and another view that contains the contents of the navigation drawer.\n\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003Candroid.support.v4.widget.DrawerLayout\nxmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\nandroid:id=\"@+id\u002FdrawerLayout\"\n   android:layout_width =\"match_parent\"\n    android:layout_height=\"match_parent\">\n  \u003C!-- Content -->\n  \u003CFrameLayout\n        android:id =\"@+id\u002FframeLayout\"\n        android:layout_width =\"match_parent\"\n        android:layout_height=\"match_parent\" \u002F>\n  \u003C!-- Navigation drawer menu -->\n  \u003CListView\n        android:id=\"@+id\u002FdrawerListView\"\n        android:layout_gravity=\"start\"\n        android:choiceMode    =\"singleChoice\"\n        android:layout_width  =\"240dp\"\n        android:layout_height =\"match_parent\"\n        android:background =\"?android:attr\u002FwindowBackground\" \u002F>\n\u003C\u002Fandroid.support.v4.widget.DrawerLayout>\nThe above layout uses a DrawerLayout with two child views: a FrameLayout to contain the main content which will be populated with a Fragment at runtime, and a ListView for the contents of the drawer.\nNow to the MainActivity.cs coding.. let’s get a reference to the drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);  You will find that DrawerLayout is not defined.  You need to add a reference via Nuget to Android Support Library v4.  Open Nuget and search for Xamarin.android.support.v4\nAndroid Support Libraries : The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.  Including the Support Libraries in your Android project is considered a best practice for application developers.\nAdding a using statement for Android.Support.V4.Widget will complete the reference to DrawerLayout.\n_menuItems = new string { \"Welcome\", \"Options\", \"About\" };\n_drawerLayout = FindViewById\u003CDrawerLayout>(Resource.Id.drawerLayout);\n_drawerList = FindViewById\u003CListView>(Resource.Id.drawerListView);\n_drawerList.Adapter = new ArrayAdapter\u003Cstring>(this, Resource.Layout.ListViewMenuRow, Resource.Id.menuRowTextView, _menuItems);\nWe have a List which should be populated by an Adapter (ArrayAdapter or SimplerCursorAdaptor)\nAt this point we have (left) and if you swipe toward the right you see the menu. \nHooking up the menu click looks like..\n_drawerList.ItemClick += _drawerList_ItemClick;\nprivate void _drawerList_ItemClick(object sender, AdapterView.ItemClickEventArgs e)\n{\n    OnMenuItemClick(e.Position);\n}private void OnMenuItemClick(int position)\n{\n    this.Title = _menuItemsposition;\n}","md",{},true,"\u002Farticles\u002Fxamarin-android-drawerlayout",{"title":6,"description":270},"articles\u002Fxamarin-android-drawerlayout",[278],"xamarin","atMZSxAPcEHLtAMZGtRMESx9f019pOvMhwLgqyfRYSM",[281],{"id":282,"title":283,"body":284,"description":288,"extension":271,"img":289,"meta":290,"name":278,"navigation":273,"path":291,"seo":292,"stem":293,"__hash__":294},"tags\u002Ftags\u002Fxamarin.md","Xamarin",{"type":9,"value":285,"toc":286},[],{"title":266,"searchDepth":267,"depth":267,"links":287},[],"Xamarin is an open-source platform for building modern and performant applications for iOS, Android, and Windows with . NET. Xamarin is an abstraction layer that manages communication of shared code with underlying platform code.","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fxamarin",{"description":288},"tags\u002Fxamarin","deVB66I7cJMtWvqybFh5POf9LBCBwHNe-5ZGMOzV5G4",{"id":296,"title":297,"author":7,"body":298,"createdAt":575,"description":576,"extension":271,"img":331,"meta":577,"navigation":273,"path":578,"seo":579,"stem":580,"tags":581,"updatedAt":575,"__hash__":582},"articles\u002Farticles\u002Fxamarin-andorid-listviews-part-1-of-2.md","Xamarin Android ListViews Part 1 of 2",{"type":9,"value":299,"toc":573},[300,309,325,334,337,340,421,424,503,506,556,559,569],[12,301,302,303,305,306,308],{},"Continuing from my drawer example code…I have a fragment (About) where I want to show a number of rows.  There are a few ways of doing this but in my case I am going to use a ListView.",[25,304],{},"\nA ListView is an important UI component of Android applications, used everywhere from short lists of menu options to long lists of contacts or internet favorites.",[25,307],{},"\nIn our example we have the following components that make up our Activity.",[310,311,312,316,319,322],"ul",{},[313,314,315],"li",{},"Activity the entire view",[313,317,318],{},"Red (our fragment)",[313,320,321],{},"Green (our listview)",[313,323,324],{},"Light Blue (our textview)",[16,326,328],{"href":327},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-listviews_aae8-image_2.png",[63,329],{"style":330,"src":331,"border":67,"alt":68,"title":68,"width":332,"height":333},"background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;","\u002Farticles\u002Fimages\u002Fwindows-live-writer-xamarin-listviews_aae8-image_thumb.png",249,404,[12,335,336],{},"Because we are working with Fragments we build our code within the OnCreateView method. ",[12,338,339],{},"I have been able to do this within OnActivityCreated as well.",[341,342,346],"pre",{"className":343,"code":344,"language":345,"meta":266,"style":266},"language-cs shiki shiki-themes github-light github-dark","public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n{\n    string[] recs = new string[2];\n    recs[0] = \"my first row\";\n    recs[1] = \"my second row\";  \n    View view = inflater.Inflate(Resource.Layout.About, container, false);\n    \u002F\u002F_context = container.Context;             \n    var listView = view.FindViewById\u003CListView>(Resource.Id.aboutListView);\n    var adapter = new ArrayAdapter\u003Cstring>(this.Activity, Resource.Layout.TextViewItem, recs);  \u002F\u002Fyou can get context also by container.Context\n    listView.Adapter = adapter;\n    return view;\n}  \n","cs",[347,348,349,356,361,367,373,379,385,391,397,403,409,415],"code",{"__ignoreMap":266},[81,350,353],{"class":351,"line":352},"line",1,[81,354,355],{},"public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)\n",[81,357,358],{"class":351,"line":267},[81,359,360],{},"{\n",[81,362,364],{"class":351,"line":363},3,[81,365,366],{},"    string[] recs = new string[2];\n",[81,368,370],{"class":351,"line":369},4,[81,371,372],{},"    recs[0] = \"my first row\";\n",[81,374,376],{"class":351,"line":375},5,[81,377,378],{},"    recs[1] = \"my second row\";  \n",[81,380,382],{"class":351,"line":381},6,[81,383,384],{},"    View view = inflater.Inflate(Resource.Layout.About, container, false);\n",[81,386,388],{"class":351,"line":387},7,[81,389,390],{},"    \u002F\u002F_context = container.Context;             \n",[81,392,394],{"class":351,"line":393},8,[81,395,396],{},"    var listView = view.FindViewById\u003CListView>(Resource.Id.aboutListView);\n",[81,398,400],{"class":351,"line":399},9,[81,401,402],{},"    var adapter = new ArrayAdapter\u003Cstring>(this.Activity, Resource.Layout.TextViewItem, recs);  \u002F\u002Fyou can get context also by container.Context\n",[81,404,406],{"class":351,"line":405},10,[81,407,408],{},"    listView.Adapter = adapter;\n",[81,410,412],{"class":351,"line":411},11,[81,413,414],{},"    return view;\n",[81,416,418],{"class":351,"line":417},12,[81,419,420],{},"}\n",[12,422,423],{},"In this example Resource.Layout.About is the name of my Fragment (public class AboutFragment : Fragment),\nResource.Id.aboutListView is referencing the ListView that was placed in the About.axml (see below), and the Resource.Layout.TextViewItem (blue)\nrepresents each row.",[341,425,429],{"className":426,"code":427,"language":428,"meta":266,"style":266},"language-xml shiki shiki-themes github-light github-dark","\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003CLinearLayout xmlns:android=\"\u003Ca href=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid&quot;\">http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\u003C\u002Fa>\n    android:orientation=\"vertical\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:minWidth=\"25px\"\n    android:minHeight=\"25px\">\n    \u003CListView\n        android:minWidth=\"25px\"\n        android:minHeight=\"25px\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:id=\"@+id\u002FaboutListView\" \u002F>\n\u003C\u002FLinearLayout>\n","xml",[347,430,431,436,441,446,451,456,461,466,471,476,481,486,491,497],{"__ignoreMap":266},[81,432,433],{"class":351,"line":352},[81,434,435],{},"\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n",[81,437,438],{"class":351,"line":267},[81,439,440],{},"\u003CLinearLayout xmlns:android=\"\u003Ca href=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid&quot;\">http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\u003C\u002Fa>\n",[81,442,443],{"class":351,"line":363},[81,444,445],{},"    android:orientation=\"vertical\"\n",[81,447,448],{"class":351,"line":369},[81,449,450],{},"    android:layout_width=\"match_parent\"\n",[81,452,453],{"class":351,"line":375},[81,454,455],{},"    android:layout_height=\"match_parent\"\n",[81,457,458],{"class":351,"line":381},[81,459,460],{},"    android:minWidth=\"25px\"\n",[81,462,463],{"class":351,"line":387},[81,464,465],{},"    android:minHeight=\"25px\">\n",[81,467,468],{"class":351,"line":393},[81,469,470],{},"    \u003CListView\n",[81,472,473],{"class":351,"line":399},[81,474,475],{},"        android:minWidth=\"25px\"\n",[81,477,478],{"class":351,"line":405},[81,479,480],{},"        android:minHeight=\"25px\"\n",[81,482,483],{"class":351,"line":411},[81,484,485],{},"        android:layout_width=\"match_parent\"\n",[81,487,488],{"class":351,"line":417},[81,489,490],{},"        android:layout_height=\"match_parent\"\n",[81,492,494],{"class":351,"line":493},13,[81,495,496],{},"        android:id=\"@+id\u002FaboutListView\" \u002F>\n",[81,498,500],{"class":351,"line":499},14,[81,501,502],{},"\u003C\u002FLinearLayout>\n",[12,504,505],{},"This is another way of approaching inside the OnActivityCreated method",[341,507,509],{"className":343,"code":508,"language":345,"meta":266,"style":266},"public override void OnActivityCreated(Bundle savedInstanceState)\n{\n    base.OnActivityCreated(savedInstanceState);    \n    string[] recs = new string[2];\n    recs[0] = \"my first row\";\n    recs[1] = \"my second row\";\n    var listView = this.Activity.FindViewById\u003CListView>(Resource.Id.aboutListView);            \n    var adapter = new ArrayAdapter\u003Cstring>(_context, Resource.Layout.TextViewItem, recs);\n    listView.Adapter = adapter;\n}  \n",[347,510,511,516,520,525,529,533,538,543,548,552],{"__ignoreMap":266},[81,512,513],{"class":351,"line":352},[81,514,515],{},"public override void OnActivityCreated(Bundle savedInstanceState)\n",[81,517,518],{"class":351,"line":267},[81,519,360],{},[81,521,522],{"class":351,"line":363},[81,523,524],{},"    base.OnActivityCreated(savedInstanceState);    \n",[81,526,527],{"class":351,"line":369},[81,528,366],{},[81,530,531],{"class":351,"line":375},[81,532,372],{},[81,534,535],{"class":351,"line":381},[81,536,537],{},"    recs[1] = \"my second row\";\n",[81,539,540],{"class":351,"line":387},[81,541,542],{},"    var listView = this.Activity.FindViewById\u003CListView>(Resource.Id.aboutListView);            \n",[81,544,545],{"class":351,"line":393},[81,546,547],{},"    var adapter = new ArrayAdapter\u003Cstring>(_context, Resource.Layout.TextViewItem, recs);\n",[81,549,550],{"class":351,"line":399},[81,551,408],{},[81,553,554],{"class":351,"line":405},[81,555,420],{},[12,557,558],{},"TextViewItem.axml",[12,560,561,562,565,568],{},"\u003CTextView xmlns:android=\"",[16,563],{"href":564},"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"",[16,566,30],{"href":30,"rel":567},[34],"\"\n    android:id=\"@+id\u002FtextItem\"\n    android:textSize=\"44sp\"\n    android:layout_width=\"fill_parent\"\n    android:layout_height=\"wrap_content\" \u002F>",[570,571,572],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":266,"searchDepth":267,"depth":267,"links":574},[],"2016-01-31T05:38:21.5000000-05:00",null,{},"\u002Farticles\u002Fxamarin-andorid-listviews-part-1-of-2",{"title":297,"description":576},"articles\u002Fxamarin-andorid-listviews-part-1-of-2",[278],"JuRG_Zcn0MsuFdCH2GNMKvH012bu4uX_lZwaO7XegO4",{"id":584,"title":585,"author":7,"body":586,"createdAt":630,"description":576,"extension":271,"img":631,"meta":632,"navigation":273,"path":633,"seo":634,"stem":635,"tags":636,"updatedAt":630,"__hash__":638},"articles\u002Farticles\u002Fvisual-studio-2015-toolbox-items-missing.md","Visual Studio 2015 Toolbox Items missing",{"type":9,"value":587,"toc":628},[588,595,612,615,620],[12,589,590,591,594],{},"Recently, I was using a 3rd party product that had toolbox items.  All was good after installation, then Visual Studio crashed,\nand my new toolbox items disappeared.  Restarting didn’t help.  I came across the following solution which\n",[213,592,593],{},"did ","solve my issue. To understand the cause of Toolbox issues and resolve them, perform the following steps:",[310,596,597,600,603,606,609],{},[313,598,599],{},"Open the \"%USERPROFILE%\\AppData\\Local\\Microsoft\\VisualStudio\\14.0\" folder and remove all .TBD files.",[313,601,602],{},"Run the Registry Editor (regedit.exe).",[313,604,605],{},"Locate the following keys:\n\"HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\14.0\\ToolboxControlsInstaller_AssemblyFoldersExCache\"\n\"HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\14.0\\ToolboxControlsInstallerCache\"",[313,607,608],{},"Remove these keys with their sub-keys.",[313,610,611],{},"Launch Visual Studio 2014 using the following command line:",[12,613,614],{},"In a 32-bit Windows:\n\"C:\\Program Files\\Microsoft Visual Studio 14.0\\Common7\\IDE\\devenv\" \u002FResetSkipPkgs \u002Flog \"\u003Cmy_folder>\\ActivityLog.xml\"\nIn a 64-bit Windows:\n\"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\devenv\" \u002FResetSkipPkgs \u002Flog \"\u003Cmy_folder>\\ActivityLog.xml\"",[310,616,617],{},[313,618,619],{},"Open Visual Studio – relaunch and hopefully all is good.",[16,621,623],{"href":622},"\u002Farticles\u002Fimages\u002Fwindows-live-writer-visual-studio-2015toolbox-items-missing_e76b-toolbox_2.jpg",[63,624],{"title":625,"style":626,"border":67,"alt":625,"src":627,"width":99,"height":99},"toolbox","border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px","\u002Farticles\u002Fimageswindows-live-writer-visual-studio-2015toolbox-items-missing_e76b-toolbox_thumb.jpg",{"title":266,"searchDepth":267,"depth":267,"links":629},[],"2016-01-20T12:29:49.0000000-05:00","\u002Farticles\u002Fimages\u002Fwindows-live-writer-visual-studio-2015toolbox-items-missing_e76b-toolbox_thumb.jpg",{},"\u002Farticles\u002Fvisual-studio-2015-toolbox-items-missing",{"title":585,"description":576},"articles\u002Fvisual-studio-2015-toolbox-items-missing",[637],"visualstudio","zdb7Iz7ZOc2BRjB-2JVcAt2ealuaketM1ImlOxRIVaU",1781574771237]