hacknik

Android Show overflow dots in actionbar

Dec 3rd, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. Show overflow dots in actionbar
  2.  
  3. Call this in oncreate
  4.  
  5.     void forceOverflow()
  6.     {
  7.         try {
  8.               ViewConfiguration config = ViewConfiguration.get(this);
  9.               Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
  10.  
  11.               if (menuKeyField != null) {
  12.                 menuKeyField.setAccessible(true);
  13.                 menuKeyField.setBoolean(config, false);
  14.               }
  15.             }
  16.             catch (Exception e) {
  17.               // presumably, not relevant
  18.             }
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment