c# - Create instance of ActionBar Xamarin Android -


Iam I have done something like using the actionbars in your app: -

  actionbars .SetDisplayHomeAsUpEnabled (true); ActionBar.SetHomeButtonEnabled (true);   

But I get a compilation error like: -

  Non-static field, method or property requires an object reference 'Android. Support .V7.App.ActionBar.SetDisplayHomeAsUpEnabled (bool) '  

How can I make an example of the actionbars because it's an abstract class?

Edit: -

I did this with the solution of the wakaslem: -

  Public Square Homescreen: Action Breakwave ™ {Personal Dreverlayout _ DAR; Private MyActionBarDrawerToggle _drawerToggle; Private list view _drawerList; Private Stable Actionbear Actionbars; Private string _drawerTitle; Private string _ title; Private string [] _planetTitles; Protected Override Zero Accuracy (Bundle Saved Instantstate) {base.OnCreate (SavedInstanceState); SupportRequestWindowFeature (WindowCompat.FeatureActionBar); SetContentView (Resource.Layout.homescreen); _title = _drawerTitle = Title; _planetTitles = Resource GetStringArere (resource.array. TitlesArray); _drawer = FindViewById & lt; DrawLayout & gt; (Resource.i.d. drawer_layout); _drawerList = FindViewById & lt; ListView & gt; (Resource.edit.left_drawer); _drawer.SetDrawerShadow (resource.Dubable.drawer_shadow_dark, (int) GravityFlags.Left); _drawerList.Adapter = New Arrayheader & lt; String & gt; (This, resource. Layout.drawerlistitem, _planetTitles); _drawerList.ItemClick + = (Sender, Args) => SelectItem (args.Position); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetHomeButtonEnabled (true); // is a drawer toggle animation that comes with the indicator next to the // // action bar icon I _drawerToggle = New MyActionBarDrawerToggle (this, _drawer, resource.drauble.ICDrawover_light, resource string.drawer open, resource.string.drownclose); // You can optionally use _drawer. The dryer was checked here _drawerToggle.DrawerClosed + = Representative {ActionBar.Title = _title; // InvalidateOptionsMenu (); }; // You can optionally use _drawer. Draw your _drawerToggle.DrawerOpened + = delegate {ActionBar.Title = _drawerTitle; // Authoritops menu (); }; _drawer.SetDrawerListener (_drawerToggle); If (Tap == Saved InstantState) Selection Item (0); }   

Now I get a nochle definitionfound error .

If you are using support.V7 , make sure that Process your activity with ActionBarActivity .

In the compatibility library to get the reference of ActionBar, you will need to use the following:

  SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetHomeButtonEnabled (true);   

For more information, in the example tab, based on the actionbars, but use the Help Library.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -