Android Question AppCompat with ToolBar RTL Direction

Peter Simpson

Expert
Licensed User
Longtime User
Can anyone please guide me how to use https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/
with RTL support ? I need to display the burger icon on the right and the menu to appear from right.

Have you looked at the app compat (Material Design) library?
https://www.b4x.com/android/forum/t...compatible-with-older-android-versions.48423/

Also look at this.
https://www.b4x.com/android/forum/threads/msmaterialmenu-animating-icons.44735/

Maybe this.
https://www.b4x.com/android/forum/threads/materialdrawer-v0-9-mike-penz.74410/#content

There's too much to look for, just search the forum for 'MaterialDrawer'...
 
Upvote 0

samikinikar

Member
Licensed User
Longtime User

Thank you so much for your support, but I could not find the burger icon and text right aligned option, I was able to get the navigationdrawer from right by changing the code to sm.Mode = sm.left to sm.right. Is there any similar way to change the burger icon and text to appear at the right ? I mean for RTL apps
 
Upvote 0

samikinikar

Member
Licensed User
Longtime User
Add SetApplicationAttribute (android:supportsRtl, true) to manifest.
Default language in phone Settings should be also RTL.

Thank you so much.....but there is no change in my output, the reason is my default language is not RTL.

Is there any way to make it RTL layout without changing the phone settings ?
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Default language defines current locale for application.
Most multi-language applications simply read settings and use appropriate resources. For example:
B4X:
    Dim jo As JavaObject
    jo.InitializeStatic ("java.util.Locale")
    Log (jo.RunMethodJO ("getDefault", Null).RunMethod ("getISO3Language", Null))
    Log (jo.RunMethodJO ("getDefault", Null).RunMethod ("getDisplayLanguage", Null))

Of course, Android offers a way to set locale in run-time. But it's not for lazy due to permanent changes in API.
For example
https://github.com/gunhansancar/Cha...hangelanguageexample/helper/LocaleHelper.java

Well, I did small library and sample (attached). They more or less work, but require some corrections, first of all, for API 26+. Probably, tomorrow evening I will clean a project.
 

Attachments

  • AppCompatRTL.zip
    5.5 KB · Views: 420
  • locale_library.zip
    2.4 KB · Views: 393
Last edited:
Upvote 0

samikinikar

Member
Licensed User
Longtime User
Default language defines current locale for application.
Most multi-language applications simply read settings and use appropriate resources. For example:
B4X:
    Dim jo As JavaObject
    jo.InitializeStatic ("java.util.Locale")
    Log (jo.RunMethodJO ("getDefault", Null).RunMethod ("getISO3Language", Null))
    Log (jo.RunMethodJO ("getDefault", Null).RunMethod ("getDisplayLanguage", Null))

Of course, Android offers a way to set locale in run-time. But it's not for lazy due to permanent changes in API.
For example
https://github.com/gunhansancar/Cha...hangelanguageexample/helper/LocaleHelper.java

Well, I did small library and sample (attached). They more or less work, but require some corrections, first of all, for API 26+. Probably, tomorrow evening I will clean a project.

Great Work.... Thank you so much.
 
Upvote 0
Top