Created
July 6, 2015 06:07
-
-
Save amatkivskiy/ae9a89dc5bd974c75e65 to your computer and use it in GitHub Desktop.
Example of Material Drawer with CustomView.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Sample | |
{ | |
using Android.App; | |
using Android.OS; | |
using Android.Widget; | |
using Mikepenz.MaterialDrawer; | |
using Android.Support.V7.App; | |
[Activity(MainLauncher = true, Label = "TestCustomDrawerViewActivity", Theme = "@style/MaterialDrawerTheme.Light.DarkToolbar.TranslucentStatus")] | |
public class TestCustomDrawerViewActivity : AppCompatActivity | |
{ | |
protected override void OnCreate(Bundle savedInstanceState) | |
{ | |
base.OnCreate(savedInstanceState); | |
SetContentView(Resource.Layout.activity_sample_dark_toolbar); | |
var toolbar = this.FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); | |
this.SetSupportActionBar(toolbar); | |
var layout = new LinearLayout(this); | |
layout.Orientation = Orientation.Vertical; | |
var image = new ImageView(this); | |
image.SetScaleType(ImageView.ScaleType.CenterInside); | |
image.SetImageResource(Resource.Drawable.header); | |
var textView = new TextView(this); | |
textView.Text = "Custom Text"; | |
textView.Gravity = Android.Views.GravityFlags.CenterHorizontal; | |
layout.AddView(image); | |
layout.AddView(textView); | |
var result = new DrawerBuilder() | |
.WithActivity(this) | |
.WithToolbar(toolbar) | |
.WithCustomView(layout) | |
.WithSavedInstance(savedInstanceState) | |
.Build(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment