-1

I am easily able to set Action bar Title in xamarin Android as follows

[Activity(Label="My App")]

How can I align above label in center?

Ravi Anand
  • 5,106
  • 9
  • 47
  • 77
  • 1
    There are a lot of answers for that in SO. For example https://stackoverflow.com/questions/5347341/how-to-align-center-the-title-or-label-in-activity or https://stackoverflow.com/questions/12387345/how-to-center-align-the-actionbar-title-in-android and much more. You can easily convert those to Xamarin code – Yuri S Jul 16 '17 at 02:22

1 Answers1

0

As Yuri S suggested, if your Activity is subclass of AppCompatActivity, then you may code for example SupportActionBar.SetCustomView(Resource.Layout.mytoolbar); to apply your custom action bar.

But if you want to inherit your activity from default Activity, you can also create your own Toolbar for action bar, and then in the OnCreate of your activity, code like this:

ActionBar.SetDisplayShowCustomEnabled(true);
ActionBar.SetCustomView(Resource.Layout.mytoolbar);
Grace Feng
  • 16,564
  • 2
  • 22
  • 45