How to disable flipping of the "up" button on the action bar? - android

Background
I've made an "app manager" alternative app, and I wish to add translation for RTL (right to left) languages.
Since I know that as of certain Android version, things got flipped to let words and sentences align correctly, I decided to first switch to such a language and then continue with the translation
The problem
After switching to an RTL language (Hebrew in my case), I've found out that the action bar's up button has the "<" image flipped horizontally:
So now it shows ">" instead.
The question
How do I fix it? It doesn't make sense to see it this way...

What worked for me was to let the system use the default theme, and not specify Holo. If you can live with that, the Up button will be oriented correctly. Unfortunately this cannot be done if you use AppCompat of course.
To make this even more annoying: the flipping of the up button is device specific. It occurs on Samsung devices but not on Google's. The supportsRtl flag is only for API 17 and above, so older Samsung phones cannot be fixed.
The issue is apparently the Holo implementation on Samsung devices. Be careful with flipping the icon since on Google phones it will be flipped wrong.
See this: https://code.google.com/p/android/issues/detail?id=68476

Well, you can access that ActionBar "up" affordance by calling Resources.getIdentifier and View.findViewById. After that you could rotate it.
final int upId = getResources().getIdentifier("up", "id", "android");
final View up = findViewById(upId);
// Call this to just rotate the icon 180°
if (getResources().getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
up.setRotation(180f);
}

Related

Prevent CollapsingToolbar continuing under status bar in Lollipop

I have developed some custom behaviours for a TextView that changes position and size based on the height of the AppBarLayout inside a CoordinatorLayout. This is so that the title appears large and in the centre of the fully expanded Toolbar when open, but in the normal title position when the ToolBar is fully collapsed.
Take a look at the videos to see it on a Lollipop device (not working correctly) and a JellyBean device (working fine).
The issue occurs (I believe, based on my tests) on Lollipop devices only, and it seems to be linked to the fact that the status bar is an overlay on the Lollipop device, but not on the JellyBean one. This is reflected in my code as well, where to calculate the final y positions I need to do the following for the final position to be correct:
if (mFinalYPosition == 0) {
mFinalYPosition = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
? (((mContext.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_default_height_material)/2)) + getStatusBarHeight())
: ((mContext.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_default_height_material)/2));
}
The best solution for me would be if I could have Lollipop devices treat the status bar in the same as earlier Android versions, i.e. in a locked position, and not as an overlay.
How would I go about achieving this?
I was able to resolve this issue by removing all android:fitsSystemWindows elements from my layout xml file. In addition, it may be clear from the video I posted that some views disappeared during the animations on my Lollipop device then reappeared later. I was able to fix this by setting the elevation on certain Views to ensure they didn't vanish behind others during animation.

Android Action bar direction RTL

I try what simon tell to do for change direction but it's doesn't working.
It's seems that for hundredth of a second it's work but when Action bar add the action buttons it's put the buttons at left instead at right.
What can be the problem? it's seems that somewhere in nmy code had line that tell freamwork to do otherwise?
The RTL value (true or false) is included in the flags in getApplicationInfo.flags.
As a long shot - is it possible that you are somehow changing the value?
The ability to set RTL was added in Android 4.2 if you are supporting this OS level or higher, this will be easier for you to accomplish.
Proof it is 4.2+: https://groups.google.com/forum/#!topic/actionbarsherlock/-npidM2Eo0w
Google post outlining how to change to RTL: https://plus.google.com/+AndroidDevelopers/posts/HuHNSb8V7s8
Otherwise, I would reference the SO question already pointed to in another comment if you are supporting an OS level older than 4.2: How to handle RTL languages on pre 4.2 versions of Android?

AIR for Android: toggle SYSTEM_UI_FLAG_HIDE_NAVIGATION

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.

Android Icons: Home Screen vs Applications Menu

On my Samsung Galaxy, application icons displayed on my Home Screen often don't match those displayed on the Applications Menu.
Firstly, I want to know if this is peculiar to Samsung/Galaxy (or some subset of Android phones), or if this is across the platform? Secondly, I'd like to know how to set this up in my Android project.
To illustrate what I'm asking, please refer to the following image:
Icons 1 and 2 are typical of a lot of third-party apps: on the Home Screen the icon transparency is honoured, but on the Applications Menu the icon is over-layed onto a button graphic. On my phone the latter is more-often-than-not a dirty-green, radial pattern.
Some apps have over-ridden this behaviour, however: icons 3 and 4 show that MapQuest has been able to specify a different base colour for the button (same radial pattern, though); and icons 5 and 6 show what appears to be a complete replacement of the button image or Application Menu icon.
Can anyone explain what I need to do to specify both forms of the icon in my project?
Thanks, in advance.
That particular effect is part of the Samsung Homescreen UI. It does something similar on the Galaxy Tablets.
icons 3 and 4 show that MapQuest has been able to specify a different base colour for the button
I don't think that they specified that I imagine that it is either luck of the draw(on Galaxy Tab there are many colors blue,green, orange, pinkish, etc...they don't appear to have any sort of pattern for which icons get which color), or it can tell that their icon is green also, and because of that it changes colors so that you don't end up with a green icon on top of a green backdrop.
and icons 5 and 6 show what appears to be a complete replacement of the button image or Application Menu icon.
I don't think they had control over that. I think it is just another one of the possible backdrops that the system uses.
Can anyone explain what I need to do to specify both forms of the icon in my project?
As far as I know you can't the backdrops are up to the 3rd part home/launcher replacement app. In this case Samsung's (but there are other home and launcher replacements on the market that could also use an effect like this if they wanted.)
Thanks, Tim - further playing around has revealed more...
As a result of refactoring my package names, I ended up with two copies of my app (with identical icons) on my Applications Menu.
As Tim suggested might happen, the second icon has a different, apparently randomly allocated, background. It would appear that the button colour is unrelated to any colour in my icon, however, as the same icon got allocated a different background.

Tab icon guidelines

http://developer.android.com/guide/practices/ui_guidelines/icon_design.html#tabstructure
Are we sure this page was written correctly? It states that UNSELECTED icons must be "WHITE"; and SELECTED icons must be "GRAY". This seems backwards and looks quite odd in my application.
This is correct for Eclair (2.0/2.1) and FroYo (2.2) Android UIs. I'm not so sure about the UIs from 1.x, though.
Sense/Motoblur might have their own standards.
That's very true since usually active tab background is white and inactive tabs are gray.

Categories

Resources