I concluded the newer android tablets doesn't have a hardware Menubutton anymore.
So I was wondering if I have to insert an menu button in my own (fullscreen) app or does android offer a software included menubutton itself (even when my app runs fullscreen)?
(I don't have an android phone/tab myself to test, so I asked here)
Thanks,
Dennis
You should move away from menu buttons. It's the new style of Android applications. See this post from Android developer with the reasons to remove the button and what applications should do instead of offering a menu button.
Most of devices which are not having menu hardware button runs on android 3.0 or greater version
You just need to add one parameter as showAsAction.
Which will show menu item on action bar.
Concider reading ActionBar tutorial
Change the manifest file: you should change targetSdkVersion to <= 10.
Like this:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="9"/>
Related
I want to toggle SYSTEM_UI_FLAG_HIDE_NAVIGATION or SYSTEM_UI_FLAG_LOW_PROFILE flag when compiling with AIR for ANDROID, but I don't know how to to this. Probably I had to modify the name_of_app.xml ...
I want to 'try' to switch off the menu bar in an Android Tablet, but every methods I try are a mess ....
Any Help ??
Massimo
If you want to remove the statusbar (the bar at the top), you need to go fullscreen. You can do this either in your app.xml by setting <fullscreen>true</fullscreen> or in your app at runtime by setting stage.displayState = StageDisplayState.FULL_SCREEN;
If you are trying to hide the menubar (the soft-navigation present at the bottom of Nexus devices and a limited number of other Android devices), this will set those buttons to be in their minified state as well (they are not hidden, but are set to a simple glowing circle rather than the icon). I do not know if it is possible through AIR to hide the menubar completely. It should be possible using an AIR Native Extension, assuming it is possible at all, but that may (likely is) more trouble than it is worth for such a simple task.
For future reference, you can't set most Android flags through AIR. It simply is not supported. You can set uses-permission and uses-feature in your app.xml as Manifest additions, but that is it.
Is there a way to completely remove the Android options menu in XE5 Delphi? I've been testing my application on a HTC One and because my phone doesn't have a menu button and my application doesn't have an options button, android automatically adds a options menu. Since this button is added by Android there is no way to add items to the menu.
I've already tried to change the minimal SDK version, but this makes the application very unstable and makes it crash when the orientation is changed:
<uses-sdk android:minSdkVersion="14" />
Is there an other way to remove the options menu? Now there is just a large options menu in the bottom of my screen that has no menu items.
Ok, you're right in that this empty action overflow menu is added because of your lack of hardware menu button.
On a Nexus 7 it's not such an issue as the empty overflow menu is added at the end of the other soft buttons.
On a HTC One, however, you can configure the Home button to act as a menu button, which removes the action overflow button.
It's not correct to say you can't add items to the menu. My Android session at CodeRage 8 shows how to add menu items. However, I'll grant you, it's a bit of a faff.
In order to remove it, the docs say you should set the targetSdkVersion attribute (not minSdkVersion) in your Android manifest to 14 (see this blog post for details). However having tried this it causes a crash if you don't prevent rotation in the RTM version of XE5, as you saw with your tests. This issue is sat in QC, logged some weeks back, hopefully to receive a fix in the near future.
However you should consider restricting the rotation as one course of action...... This is easy enough.
you must change in manifest android:configChanges="orientation|keyboardHidden">
to:
android:configChanges="orientation|keyboardHidden|screenSize">
then you can set minsdk, maxsdk, targetsdk as you want, and application will not crash
I am trying to implement an action bar with tabs as navigation options. To do that I select the "Tabs+Swipe" option in the "New Blank Activity" section of the "New Android App" wizard as shown below.
Now, in the android manifest, when
android:targetSdkVersion="15"
which is the default value, the action bar looks like this on a Nexus 7/Nexus 7 emulator, this is the desired look of the app
Now when I change that line in the android manifest to
android:targetSdkVersion="16"
the look of the action bar changes to this
The default look remains for any version of android but 16, can anyone please explain why the look of the action bar suddenly changes when the targetSdkVersion is set to 16?
The above is reproducible in the emulator as as well as on a real nexus 7.
Full screengrabs for
Normal: http://i.stack.imgur.com/VsBA2.png
After android:targetSdkVersion="16": http://i.stack.imgur.com/OM6Y4.png
Update-10th March, 2013: Switched to the List Navigation mode (instead of Tabs) to enable move to android:targetSdkVersion=17
The reason it changes when setting targetSDK to 16 is because Google changed how tabs are measured in Jelly Bean. Specifically, look at this in android.internal.view.ActionBarPolicy:
public boolean hasEmbeddedTabs() {
final int targetSdk = mContext.getApplicationInfo().targetSdkVersion;
if (targetSdk >= Build.VERSION_CODES.JELLY_BEAN) {
return mContext.getResources().getBoolean(R.bool.action_bar_embed_tabs);
}
// The embedded tabs policy changed in Jellybean; give older apps the old policy
// so they get what they expect.
return mContext.getResources().getBoolean(R.bool.action_bar_embed_tabs_pre_jb);
}
However, I suspect you don't just want the reason, but a solution. Unfortunately, I can't give you a straightforward way to set it to only embedded.
I can suggest using ActionBarSherlock to make it consistent, though. The bonus to that is the ability to use actionbars on older devices. When using it(portrait), I can confirm that if you set the targetSDK to 16, it uses the stacked layout on Jelly Bean, Ice Cream Sandwich, GingerBread, and Froyo. At least you will be able to design your layout while knowing what to expect.
Keep in mind that in most cases, switching to landscape mode will embed them in the actionbar again, since there is "enough room" the way it measures.
I write an application.
It run on Android 2.3.4 phone, the menu can be pressed.
But if run on Android 4.0.3 TF201, the menu button not show.
How to let it show the menu button?
Android 4.0 will discontinue the menu button. Here is a nice article by android developers that says what to do.
If you want to give menu feature in android 4.0, you have to use Action Bar instead.Follow this link for more details
If you have to use that menu use the following lines in your Manifest file:
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="9" >
</uses-sdk>
But sometimes you want a fullscreen app...for example in the Manifest is setted the activity with:
android:theme="#android:style/Theme.NoTitleBar"
The only and ugly fix is to set under the target sdk version:
http://lancelotmobile.com/blog/mobile-air-app-compatible-with-android-4/
When I try to show context menu in Android 3.0 instead of normal menu I see smth like in this picture - which is basically text edit/select menu.
On other devices (e.g. for SDK 5-9) it shows my context menu registered for my TextView
Anyone knows - what's going om?
I have found solution by entering in AndroidManifest.xml following snippet:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="11"/>
After that context menu in tablets is appearing as on other devices. Essential part is android:tagetSdkVersion attribute