Skip to content
Advertisement

How to get ActionBar “customView” width

How can I get the width of the customView of the toolbar/actionbar as highlighted below?

enter image description here

I had the idea to get the whole screenWidth and substract the x coordinate of the “custom area” but I can’t/don’t know how get the x coordinate of that.

JavaScript

Advertisement

Answer

hi i have this solution to get the value of x it’s work fine for me the idea is getting the toolbar from action Bar and the textView from toolBar:

JavaScript

hope that’s help you

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement