0

I want to set the coordinates of my button equal to the coordinates of the point I touch on mobile. I am using the method getRawX() and getRawY().

button.setY(event.getRawY() -  actionBarHeight - notificationBarHeight);

How can I get height of my Action Bar and Notification Bar.

Jamie Eltringham
  • 810
  • 3
  • 16
  • 25
Aman
  • 23
  • 8
  • 1
    you can find solution from here http://stackoverflow.com/questions/12301510/how-to-get-the-actionbar-height – GiapLee Mar 02 '16 at 09:52

1 Answers1

1

You can get the height of your ActionBar with

getActionBar().getHeight();

It's said here (answer 3 and 4) that status bar is 25dp until Marshmallow, and 24dp since Marshmallow.

Community
  • 1
  • 1
  • Please tell me the way to get height of notification bar too. – Aman Mar 02 '16 at 10:43
  • I don't really understand what is the notification bar, can you put a screenshot ? – bastien pinaquy Mar 02 '16 at 11:20
  • Notification bar is the same as status bar, where time, battery, signals, etc are shown, which you drag down from the top to see the notifications of calls, messages and other. – Aman Mar 02 '16 at 11:41