0

Basically, I want to make sure my UI elements (TextViews, Buttons, etc) are left aligned with the ActionBar logo. My idea was to try to find out the left spacing between the edge of the screen and the left side of the logo (shown highlighted in blue in the attached image), and use this value as the left margin for the UI elements in my Activity, but I've been unable to get this value.

enter image description here

So, how can I get the value of this margin? Or, is there a better way of accomplishing this?

Thanks.

Henrique
  • 4,921
  • 6
  • 36
  • 61

2 Answers2

0

Just use the standards for defining paddings as described in the Android Design documents on d.android.com. This page gives a good example of how your layout must be structured in terms of paddings between elements.

Egor
  • 39,695
  • 10
  • 113
  • 130
  • Thanks, but I've already gone through that part of the Android documentation and it doesn't specify the specific Actionbar padding values I'm looking for. – Henrique Jan 20 '15 at 02:54
  • The point is that you should just use the standard padding values and not the ActionBar padding. – Egor Jan 20 '15 at 04:37
  • Yeah, I agree, but sometimes clients want what clients want :) – Henrique Jan 20 '15 at 14:41
0

You check these answers . Custom layout for the action bar worked for me to change this padding and you can also get padding value.

remove padding around action bar left icon on Android 4.0+

Community
  • 1
  • 1
bkaramik
  • 88
  • 7