0

I have an androidx application that uses an ActionBar for the main activity. It has the standard options (...) button on the right side. All good.

What I'd like to do is to implement a long press on that (...) button which would allow me to display an advanced menu - this is in support of a demo where a "super user" will need additional options.

So my question is, can I get a reference to that (...) button and add a long press handler?

svenyonson
  • 1,715
  • 1
  • 19
  • 27
  • Maybe you can follow this https://stackoverflow.com/questions/9261329/android-actionbar-options-long-click-event – latifalbr Oct 05 '21 at 01:54
  • You could use some of the techniques commonly used to get other inaccessible things in the `ActionBar`/`Toolbar`, like the navigation `Button` or the title `TextView`. Here are a couple of examples modified for the overflow button: https://drive.google.com/file/d/1lj-pZPxSMPgoAVseu0Eqwbvpk88VDzFd/view?usp=sharing. There are others, if needed. Setting your own listener shouldn't be a problem, but it will break the tooltip (but you probably don't want that with your menu anyway). – Mike M. Oct 05 '21 at 02:17

0 Answers0