I really suffer from this issue.
I already set the flag android:configChanges="keyboardHidden|orientation|locale"
But when I changed configuration of language, onconfigurationchanged function isn't called.
The strange thing is that my codes work fine over other android platform.
I searched this issue here.
Someone said that I need to set sdk version lower. But it didn't work.
Please give me some tips.
Add the layoutDirection attribute, such as android:configChanges="keyboardHidden|orientation|locale|layoutDirection" if you're working with API 17.
layoutDirection that is also connected with interface language changes was introduced in API 17. Piece of android docs about android:configChanges is not explicit enough about that fact, but at least we have:
layoutDirection: The layout direction has changed. For example, changing from
left-to-right (LTR) to right-to-left (RTL). Added in API level 17.
From Android 4.2, layout direction will be updated when we change language.
Then we have to add both "locale" and "layoutDirection" as below
android:configChanges="locale|layoutDirection",
that time onConfigurationChanged() will be called.
This is similar with "orientation" and "screenSize" in API 13.
do u config AndroidManifest.xml like this?
android:minSdkVersion="4" android:targetSdkVersion="17"
you need to remove android:targetSdkVersion attribute
Related
I am trying to add RTL support in my app where layout direction should also change to RTL on force setting to RTL.
I have followed:
Set minSdkVersion to 19 ,
Added android:supportsRtl="true" to application tag in AndroidManifest.xml,
Switched left/right attributes to start/end
Followed this link.
However, even when I use the "Force RTL Layout Direction", my app doesn't display the RTL layout. The system UI is flipped to RTL, and other apps also support RTL.
Is there anything else that need to be done?
in manifest.xml
add android:supportsRtl="true" in tag
and in every activity add this line in onCreate method
getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
There is a much easier way to do the above changes without going through all the files and then doing it manually. Android Studio can do this for you.
Just go to Android Studio > Refactor > Add RTL support where
possible…
or
try to use this link :
link
Found the reason:
was using older version of mixpanel library
compile "com.mixpanel.android:mixpanel-android:4.6.0"
updated to latest version
compile "com.mixpanel.android:mixpanel-android:5.4.0"
hence ,check the libarary version,n update to latest.
i made this android:supportsRtl="false" for my application
and yet it still flip my layout views when i change the language from English to Arabic and verse versa any clues what to do to prevent the views from flipping not matter what language it runs on or API level
thanks
If targetSdkVersion is set to 16 or lower then it will ignore the RTL support. Otherwise if you change the language then it will support RTL.
As this attribute is supported from the API 17.
Ref Link: https://developer.android.com/guide/topics/manifest/application-element
I am really new to android so pardon me. Why is there a strike-through
for example (fill_parent)
in some android variables and not others
The strikeout shows deprecated methods or attributes (assuming you are using Android Studio / IntelliJ). In your case FILL_PARENT (LayoutParams?) is deprecated for a really long time (API Level 8). It is now called MATCH_PARENT (see https://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html). Hovering the variable should show you a tooltip with more information on the deprecation and when it was deprecated. Just make sure you don't use those deprecated elements.
I have a LinearLayout and on some devices all the views are reversed.
The Good Version:
[b1] [b2] [b3]
On some devices:
[b3] [b2] [b1]
Why does that happen and how can I fix it?
If you're targeting and testing on API level >=17 (i.e. Android 4.2) this might be caused by RTL support, as described here.
If you don't want this, you can either change android:layoutDirection for each particular view (and since the default is inherit, the root view should suffice) or you can disable it for the whole application by setting android:supportsRtl="false" in the AndroidManifest.xml file.
Or, you could also target an API level < 17, since it will then be disabled for compatibility (but this would lock you out of certain APIs).
It appears that API level 13 has ("silently" as far as I can tell) introduced a change to how android:configChanges attribute is handled.
In my particular case, when "targetSdkVersion" in the app manifest is set to "13" any activities that are configured to internally handle orientation changes (e.g. should not be restarted on screen rotation) are being always restarted regardless of the android:configChanges="orientation" attribute in their declarations.
A simple switch of the "targetSdkVersion" to "12" restores the expected behavior.
I searched the API 13 release notes and could not find any mention of such change. Does anyone know if API 13 (and possibly later APIs) will by design not support android:configChanges="orientation", or if there is another approach to achieve this.
Looks like there is some new documentation for configChanges, specifically referring to HONEYCOMB_MR2 release. Maybe you can try using orientation|screenSize|smallestScreenSize, see if that changes behavior. Hope that at least leads you in the proper direction.
try this: <android:configChanges="orientation|screenSize"/>