3

I'm using ABS for backwards compatibility. In one of my activities, I'm using Action Bar tabs which appear before custom view (in landscape) in action bar so I can't use that. So i'm using Action bar title. So in short, my question is how do I increase the spacing between the title and the icon?

Rahul Sainani
  • 3,437
  • 1
  • 34
  • 48

2 Answers2

9

I added some spacing like this:

actionBar.setTitle("  " + myTitle);

I don't think it should be done this way but I've searched a lot I couldn't find any solution for this without using custom view which I can't because I'm using AB tabs.

So if anyone else has a better (cleaner) solution, do answer. For others, this works better than anything else I tried.

Cheers!

Rahul Sainani
  • 3,437
  • 1
  • 34
  • 48
1

Adding these link in Toolbar declaration in xml file.

app:contentInsetLeft="16dp"
app:contentInsetStart="16dp"
app:contentInsetEnd="16dp"
app:titleMarginStart="32dp"

Pay attention at the app prefix. This worked for me with Android 4.4.2 and Android 5.1.

nhoxbypass
  • 9,695
  • 11
  • 48
  • 71