本文整理汇总了C#中DrawerLayout.SetDrawerShadow方法的典型用法代码示例。如果您正苦于以下问题:C# DrawerLayout.SetDrawerShadow方法的具体用法?C# DrawerLayout.SetDrawerShadow怎么用?C# DrawerLayout.SetDrawerShadow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawerLayout
的用法示例。
在下文中一共展示了DrawerLayout.SetDrawerShadow方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
setup();
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
drawerList = FindViewById<RecyclerView>(Resource.Id.left_drawer);
drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
drawerList.SetLayoutManager(new LinearLayoutManager(this));
adapter = new MenuAdapter();
drawerList.SetAdapter(adapter);
// enable ActionBar app icon to behave as action to toggle nav drawer
this.ActionBar.SetDisplayHomeAsUpEnabled(true);
this.ActionBar.SetHomeButtonEnabled(true);
this.ActionBar.Title = "Test";
drawerToggle = new MainDrawerToggle(this, drawerLayout,
Resource.Drawable.ic_drawer,
Resource.String.drawer_open,
Resource.String.drawer_close);
drawerLayout.AddDrawerListener(drawerToggle);
drawerLayout.CloseDrawer(drawerList);
vm.NavigatedTo(null);
}
示例2: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
//SupportFragmentManager.PopBackStackImmediate(null, (int)PopBackStackFlags.Inclusive);
SetContentView(Resource.Layout.page_home_view);
_title = _drawerTitle = Title;
_drawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
_drawerList = FindViewById<MvxListView>(Resource.Id.left_drawer);
SupportActionBar.SetDisplayHomeAsUpEnabled(true);
SupportActionBar.SetHomeButtonEnabled(true);
SupportActionBar.SetBackgroundDrawable(Resources.GetDrawable(Resource.Color.s_main_green));
SupportActionBar.SetLogo(Resource.Drawable.logo_white);
if (_drawer != null)
{
_drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
//DrawerToggle is the animation that happens with the indicator next to the
//ActionBar icon. You can choose not to use this.
_drawerToggle = new MyActionBarDrawerToggle(this, _drawer,
Resource.Drawable.ic_navigation_drawer,
Resource.String.drawer_open,
Resource.String.drawer_close);
_drawerToggle.DrawerClosed += delegate
{
Title = _title;
SupportInvalidateOptionsMenu(); };
_drawerToggle.DrawerOpened += delegate
{
SupportActionBar.Title = _drawerTitle;
SupportInvalidateOptionsMenu();
// Close open soft keyboard when drawer opens.
var inputManager = (InputMethodManager)GetSystemService(InputMethodService);
inputManager.HideSoftInputFromWindow(Window.DecorView.WindowToken, 0);
};
_drawer.SetDrawerListener(_drawerToggle);
}
RegisterForDetailsRequests();
if (null == savedInstanceState)
{
ViewModel.SelectMenuItemCommand.Execute(ViewModel.MenuItems[0]);
}
}
示例3: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.main);
sections = Resources.GetTextArray(Resource.Array.drawer_sections);
currentSectionTitle = drawerTitle = Title;
drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
drawerListView = FindViewById<ListView>(Resource.Id.left_drawer);
drawerListView.Adapter = new ArrayAdapter<string>(this, Resource.Layout.item_menu, sections);
drawerListView.ItemClick += (sender, args) => ListItemClicked(args.Position);
drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
//DrawerToggle is the animation that happens with the indicator next to the actionbar
drawerToggle = new DrawerToggle(this, drawerLayout,
Resource.Drawable.ic_drawer_light,
Resource.String.drawer_open,
Resource.String.drawer_close);
//Display the current fragments title and update the options menu
drawerToggle.DrawerClosed += (o, args) =>
{
ActionBar.Title = currentSectionTitle;
InvalidateOptionsMenu();
};
//Display the drawer title and update the options menu
drawerToggle.DrawerOpened += (o, args) =>
{
ActionBar.Title = drawerTitle;
InvalidateOptionsMenu();
};
//Set the drawer lister to be the toggle.
drawerLayout.SetDrawerListener(drawerToggle);
//If first time you will want to go ahead and click first item.
if (savedInstanceState == null)
{
ListItemClicked(0);
}
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
}
示例4: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Menu);
_title = _drawerTitle = Title;
_menuTitles = Resources.GetStringArray(Resource.Array.MenuArray);
_drawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
_drawerList = FindViewById<ListView>(Resource.Id.left_drawer);
_drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
_drawerList.Adapter = new ArrayAdapter<string>(this,
Resource.Layout.drawer_item, _menuTitles);
_drawerList.ItemClick += (sender, args) => SelectItem(args.Position);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
ActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent)));
//DrawerToggle is the animation that happens with the indicator next to the
//ActionBar icon. You can choose not to use this.
_drawerToggle = new MyActionBarDrawerToggle(this, _drawer,
Resource.Drawable.ic_drawer_light,
Resource.String.DrawerOpen,
Resource.String.DrawerClose);
//You can alternatively use _drawer.DrawerClosed here
_drawerToggle.DrawerClosed += delegate
{
ActionBar.Title = _title;
ActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent)));
InvalidateOptionsMenu();
};
//You can alternatively use _drawer.DrawerOpened here
_drawerToggle.DrawerOpened += delegate
{
ActionBar.Title = _drawerTitle;
InvalidateOptionsMenu();
};
_drawer.SetDrawerListener(_drawerToggle);
if (null == savedInstanceState)
SelectItem(0);
}
示例5: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
drawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
drawerLayout.SetDrawerShadow (Resource.Drawable.drawer_shadow, (int)GravityFlags.Start);
drawerList = FindViewById<ListView> (Resource.Id.flyout);
drawerList.Adapter = new ArrayAdapter<string> (this, Resource.Layout.drawer_list_item, sections);
drawerToggle = new ActionBarDrawerToggle (this, drawerLayout, Resource.String.drawer_open, Resource.String.drawer_close);
drawerLayout.SetDrawerListener (drawerToggle);
drawerList.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => ListItemClicked (e.Position);
ListItemClicked (0);
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
}
示例6: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.Main);
drawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
drawerLayout.SetDrawerShadow (Resource.Drawable.drawer_shadow, (int)GravityFlags.Start);
drawerToggle = new ActionBarDrawerToggle (this, drawerLayout, Resource.Drawable.ic_drawer, Resource.String.drawer_open, Resource.String.drawer_close);
drawerLayout.SetDrawerListener (drawerToggle);
drawerList = FindViewById<ListView> (Resource.Id.flyout);
drawerList.Adapter = new ArrayAdapter<string> (this, Resource.Layout.drawer_list_item, sections);
drawerList.ItemClick += (sender, e) => ListItemClicked (e.Position);
ListItemClicked (0);
// Enabling the home button as "up" will show a "go back button" by default. This will be changed by the drawer into a "hamburger" button.
// This will also implicitly enable the home button (http://developer.android.com/reference/android/support/v7/app/ActionBar.html#setHomeButtonEnabled(boolean)).
ActionBar.SetDisplayHomeAsUpEnabled (true);
}
示例7: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.activity_navigation_drawer);
mDrawerTitle = this.Title;
mPlanetTitles = this.Resources.GetStringArray (Resource.Array.planets_array);
mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
mDrawerList = FindViewById<RecyclerView> (Resource.Id.left_drawer);
// set a custom shadow that overlays the main content when the drawer opens
mDrawerLayout.SetDrawerShadow (Resource.Drawable.drawer_shadow, GravityCompat.Start);
// improve performance by indicating the list if fixed size.
mDrawerList.HasFixedSize = true;
mDrawerList.SetLayoutManager (new LinearLayoutManager (this));
// set up the drawer's list view with items and click listener
mDrawerList.SetAdapter (new PlanetAdapter (mPlanetTitles, this));
// enable ActionBar app icon to behave as action to toggle nav drawer
this.ActionBar.SetDisplayHomeAsUpEnabled (true);
this.ActionBar.SetHomeButtonEnabled (true);
// ActionBarDrawerToggle ties together the the proper interactions
// between the sliding drawer and the action bar app icon
mDrawerToggle = new MyActionBarDrawerToggle (this, mDrawerLayout,
Resource.Drawable.ic_drawer,
Resource.String.drawer_open,
Resource.String.drawer_close);
mDrawerLayout.SetDrawerListener (mDrawerToggle);
if (savedInstanceState == null) //first launch
selectItem (0);
}
示例8: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
// set our layout to be the home screen
SetContentView(Resource.Layout.HomeScreen);
var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
if (toolbar != null)
{
SetActionBar(toolbar);
}
menuItemsShelves = AllOurVinylManager.GetShelves().Select(x => x.Name).ToArray();
homeLayout = FindViewById<DrawerLayout>(Resource.Id.home_layout);
homeLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
drawerList = FindViewById<ListView>(Resource.Id.left_drawer);
drawerList.Adapter = new ArrayAdapter<string>(this, Resource.Layout.DrawerListItem, menuItemsShelves);
drawerList.ItemClick += (sender, args) => SelectItem(args.Position);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
drawerToggle = new MyActionBarDrawerToggle(this, homeLayout,
Resource.Drawable.ic_drawer_dark,
Resource.String.DrawerOpen,
Resource.String.DrawerClose);
drawerToggle.DrawerClosed += delegate
{
//ActionBar.Title = _title;
InvalidateOptionsMenu();
};
//You can alternatively use _drawer.DrawerOpened here
drawerToggle.DrawerOpened += delegate
{
//ActionBar.Title = _drawerTitle;
InvalidateOptionsMenu();
};
homeLayout.SetDrawerListener(drawerToggle);
if (null == bundle)
SelectItem(0);
}
示例9: InitializationDrawer
private void InitializationDrawer()
{
/*
fDrawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
fDrawerListLeft = FindViewById<ListView>(Resource.Id.left_drawer);
fDrawerListLeft.Adapter = new ArrayAdapter<string>(this, Resource.Layout.item_menu, Sections);
fDrawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
*/
fTitle = fDrawerTitle = Title;
fDrawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
fDrawerListLeft = FindViewById<ListView>(Resource.Id.left_drawer);
fDrawerListLeft.Adapter = new ArrayAdapter<string>(this, Resource.Layout.item_menu, Sections);
fDrawerListLeft.ItemClick += (sender, args) => ListItemClickedLeft(args.Position);
fDrawerListRight = FindViewById<ListView>(Resource.Id.right_drawer);
fDrawerListRight.Adapter = new ArrayAdapter<string>(this, Resource.Layout.item_menu, Sections);
fDrawerListRight.ItemClick += (sender, args) => ListItemClickedRight(args.Position);
fDrawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
//DrawerToggle is the animation that happens with the indicator next to the actionbar
fDrawerToggle = new MyActionBarDrawerToggle(this,
fDrawer,
Resource.Drawable.ic_drawer_light,
Resource.String.drawer_open,
Resource.String.drawer_close);
//Display the current fragments title and update the options menu
fDrawerToggle.DrawerClosed += (o, args) =>
{
ActionBar.Title = fTitle;
InvalidateOptionsMenu();
};
//Display the drawer title and update the options menu
fDrawerToggle.DrawerOpened += (o, args) =>
{
ActionBar.Title = fDrawerTitle;
InvalidateOptionsMenu();
};
//Set the drawer lister to be the toggle.
fDrawer.SetDrawerListener(fDrawerToggle);
}
示例10: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.InitActivity);
ColorDrawable colorDrawable = new ColorDrawable (Color.ParseColor (Colores.BaseColo));
ActionBar.SetBackgroundDrawable (colorDrawable);
ActionBar.SetIcon (Resource.Drawable.ic_action_icon);
ActionBar.SetDisplayHomeAsUpEnabled (true);
ActionBar.SetHomeButtonEnabled (true);
_title = _drawerTitle = Title;
try {
_drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
_drawerList = FindViewById<ListView> (Resource.Id.left_drawer);
LoadMenu (2);
var inputView = this.LayoutInflater.Inflate (Resource.Layout.ProcessBarView, null);
ImgLogo = inputView.FindViewById<ImageView> (Resource.Id.ImgLogo);
TxtEntrar = inputView.FindViewById<TextView> (Resource.Id.TxtEntrar);
TxtContact = inputView.FindViewById<TextView> (Resource.Id.TxtContact);
_drawerList.AddHeaderView (inputView);
_drawer.SetDrawerShadow (Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Left);
_drawerList.ItemClick += (sender, args) => SelectItem (args.Position);
_drawerToggle = new MyActionBarDrawerToggle (this, _drawer,
Resource.Drawable.ic_drawer_light,
Resource.String.DrawerOpen,
Resource.String.DrawerClose);
_drawerToggle.DrawerClosed += delegate {
ActionBar.Title = _title;
InvalidateOptionsMenu ();
};
_drawerToggle.DrawerOpened += delegate {
ActionBar.Title = _drawerTitle;
InvalidateOptionsMenu ();
LoadUserDatos ();
};
_drawer.SetDrawerListener (_drawerToggle);
if (bundle == null) {
SelectItem (1);
}
LoadUserDatos ();
} catch (Exception) {
return;
}
}
示例11: Setup
/// <summary>
/// Users of this fragment must call this method to set up the navigation drawer interactions.
/// </summary>
/// <param name="fragmentId">The <c>android:id</c> of this fragment in its activity's layout.</param>
/// <param name="drawerLayout">The <see cref="DrawerLayout"/> containing this fragment's UI.</param>
public void Setup(int fragmentId, DrawerLayout drawerLayout)
{
this.drawerLayout = drawerLayout;
fragmentContainerView = Activity.FindViewById(fragmentId);
drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
drawerToggle = new NavigationDrawerToggle(Activity,
drawerLayout,
0,
0);
drawerToggle.Closed += (sender, args) => Activity.InvalidateOptionsMenu();
drawerToggle.Opened += (sender, args) => Activity.InvalidateOptionsMenu();
drawerToggle.SyncState();
drawerLayout.SetDrawerListener(drawerToggle);
// Select either the default item (0) or the last selected item.
SelectItem(currentSelectedPosition);
}
示例12: SetUp
/// <summary>Users of this fragment must call this method to set up the navigation drawer interactions.
/// </summary>
/// <remarks>Users of this fragment must call this method to set up the navigation drawer interactions.
/// </remarks>
/// <param name="fragmentId">The android:id of this fragment in its activity's layout.
/// </param>
/// <param name="drawerLayout">The DrawerLayout containing this fragment's UI.</param>
public virtual void SetUp(int fragmentId, DrawerLayout drawerLayout)
{
mFragmentContainerView = Activity.FindViewById(fragmentId);
mDrawerLayout = drawerLayout;
mDrawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
ActionBar actionBar = GetActionBar();
actionBar.SetDisplayHomeAsUpEnabled(true);
actionBar.SetHomeButtonEnabled(true);
// ActionBarDrawerToggle ties together the the proper interactions
// between the navigation drawer and the action bar app icon.
// calls onPrepareOptionsMenu()
// calls onPrepareOptionsMenu()
// Defer code dependent on restoration of previous instance state.
mDrawerLayout.DrawerOpened += async (sender, e) => {
mDrawerToggle.OnDrawerOpened(e.DrawerView);
if (!IsAdded)
{
return;
}
Activity.InvalidateOptionsMenu();
mDrawerToggle.SyncState();
};
mDrawerLayout.DrawerClosed += async (sender, e) => {
mDrawerToggle.OnDrawerClosed(e.DrawerView);
if (!IsAdded)
{
return;
}
Activity.InvalidateOptionsMenu();
mDrawerToggle.SyncState();
};
mDrawerLayout.SetDrawerListener(mDrawerToggle);
}
示例13: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Menu);
Intent t = this.Intent;
bool firstload=t.GetBooleanExtra("FirstLoad",false);
if (firstload == true) {
}
User sv = BUser.GetMainUser (SQLite_Android.GetConnection ());
_title = _drawerTitle = Title;
_menuTitles = Resources.GetStringArray(Resource.Array.MenuArray);
_drawer = FindViewById<DrawerLayout>(Resource.Id.drawer_layout);
_drawerList = FindViewById<ListView>(Resource.Id.left_drawer);
_drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_dark, (int)GravityFlags.Start);
View header = this.LayoutInflater.Inflate (Resource.Layout.DrawerHeader, null);
header.FindViewById<TextView> (Resource.Id.txtTenSV).Text=sv.Hoten;
header.FindViewById<TextView> (Resource.Id.txtmasv).Text=sv.Id;
_drawerList.AddHeaderView (header);
List<DrawerItem> listItems = new List<DrawerItem> ();
// listItems.Add(new DrawerItem(namesv,Resource.Drawable.user,true));
listItems.Add(new DrawerItem("Lịch Học",0,false,true));
listItems.Add(new DrawerItem("Theo Học Kỳ",Resource.Drawable.Iclichhoc,true,false));
listItems.Add(new DrawerItem("Theo Tuần",Resource.Drawable.calendar,false,false));
listItems.Add(new DrawerItem("Điểm Thi",0,false,true));
listItems.Add(new DrawerItem("Theo Học Kỳ",Resource.Drawable.Icdiemthi,true,false));
listItems.Add(new DrawerItem("Tất Cả",Resource.Drawable.IcAdiemthi,false,false));
listItems.Add(new DrawerItem("Học Phí-Lịch Thi",0,false,true));
listItems.Add(new DrawerItem("Lịch Thi",Resource.Drawable.Iclichthi,true,false));
listItems.Add(new DrawerItem("Học Phí",Resource.Drawable.Ichocphi,false,false));
listItems.Add(new DrawerItem("Ứng Dụng",0,false,true));
listItems.Add(new DrawerItem("Cài đặt",Resource.Drawable.Icsettings,true,false));
listItems.Add (new DrawerItem ("Đăng xuất", Resource.Drawable.signout,false,false));
_drawerList.Adapter = new CustomDrawerAdapter (this, listItems);
_drawerList.ItemClick += (sender, args) => SelectItem(args.Position);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
ActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent)));
//DrawerToggle is the animation that happens with the indicator next to the
//ActionBar icon. You can choose not to use this.
_drawerToggle = new MyActionBarDrawerToggle(this, _drawer,
Resource.Drawable.ic_menu_white_18dp,
Resource.String.DrawerOpen,
Resource.String.DrawerClose);
//You can alternatively use _drawer.DrawerClosed here
_drawerToggle.DrawerClosed += delegate
{
ActionBar.Title = _title;
ActionBar.SetIcon(new ColorDrawable(Resources.GetColor(Android.Resource.Color.Transparent)));
InvalidateOptionsMenu();
};
//You can alternatively use _drawer.DrawerOpened here
_drawerToggle.DrawerOpened += delegate
{
ActionBar.Title = _drawerTitle;
InvalidateOptionsMenu();
};
_drawer.SetDrawerListener(_drawerToggle);
this.ActionBar.SetDisplayHomeAsUpEnabled(true);
this.ActionBar.SetHomeButtonEnabled(true);
if (null == savedInstanceState) {
SelectItem (2);
previousItemChecked = 2;
}
}