View over Flow Action Items - Android User Interface

Android examples for User Interface:View

Description

View over Flow Action Items

Demo Code


//package com.java2s;
import java.lang.reflect.Field;

import android.content.Context;

import android.view.ViewConfiguration;

public class Main {
    /**/*w  ww  .  j  a v  a  2  s.  co  m*/
     * @param context
     * 
     *            Enable the overflowMenuItem in the action bar , The three dot
     *            thingy is displayed NOTE: TO BE CALLED AT THE END OF THE
     *            ONCREATE
     */
    public static void overFlowActionItems(Context context) {
        try {
            ViewConfiguration config = ViewConfiguration.get(context);
            Field menuKeyField = ViewConfiguration.class
                    .getDeclaredField("sHasPermanentMenuKey");
            if (menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Exception ex) {
            // Ignore
        }
    }
}

Related Tutorials