Android examples for User Interface:ActionBar
Forces actionbar items to be in actionbar otherwise phones might show it in bottom bar spinner instead of actionbar
//package com.java2s; import java.lang.reflect.Field; import android.app.Activity; import android.view.ViewConfiguration; public class Main { /**/*from w w w . j a va2 s .co m*/ * Forces actionbar items to be in actionbar * otherwise phones might show it in bottom bar spinner * instead of actionbar * @param the activity, should be 'this' */ public static void forceShowActionBar(Activity act) { try { ViewConfiguration config = ViewConfiguration.get(act); Field menuKeyField = ViewConfiguration.class .getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception ex) { // Ignore } } }