Android - want to display a 3-point menu on ICS

I want to show a 3-dot overflow menu key (next to the RecentApp virtual key) when creating my application with

android:targetSdkVersion="15" 

Here is my story. My application includes two lib projects (only jars + res no source), lib-a uses the menu; when the application was created with target-sdk = 10, it works well, the 3-point icon is displayed next to the RecentApp key in the system navigation panel. Now lib-b has received the update, I have to create an application with target-sdk = 15, but this makes the lib-UI menu disappear. I want lib-a to have a menu as before.

I checked these posts which are very useful,

Android Action Bar menu does not appear when sdk target version is greater than 10

Android theme, fullscreen and action bar

I can’t use ActionBarSherlock and don’t set target-sdk to 10. So I wonder if using an old theme (not a bare theme) will help. I created a theme derived from [android.Theme] for all activities in lib-a (in the xml application manifest), but no luck.

So my question is: can the topic solve the problem?

+1
android android-actionbar android-theme android-menu
Apr 24 '13 at 15:43
source share
3 answers

I think you just can't. This "overflow menu" in the system panel exists for outdated reasons, and it appears if and only if the outdated application (target sdk <11) is running on a device with a virtual system panel. It is simply not intended to be displayed when setting up higher versions.

+2
Apr 24 '13 at 15:56
source share

No, you cannot do this. You can download an earlier version of actionBarSherlock (e.g. 4.1.0), where absForceOverflow was an existing method, so this will force your three-point menu to each system to 1.6, but this can cause problems (e.g. phones with a hardware keyboard, etc. .).

I stumbled on this issue a couple of weeks ago, and I solved it with a workaround: a simple menu icon in the action bar (three-dot icon), and if you click on it, a custom dialog box will appear that looks just like the original (you can programmatically put it in the right place, since you know that the default height is in the bar (for example, 48 dp on hdpi phones)).

Hope this helps.

+1
Apr 24 '13 at 16:06
source share

Yes, you just need to change targetVersion from your onCreate method as follows:

 @Override public void onCreate(Bundle savedInstanceState) { getApplicationInfo().targetSdkVersion = 10; // To enable the 3-dot menu call this code before super.OnCreate super.onCreate(savedInstanceState); } 

Tested on Android 4.xx and Android 3.0

0
Jul 28 '14 at 16:32
source share



All Articles