Force RTL layout direction not working for app

后端 未结 2 1121
南方客
南方客 2020-12-14 16:49

I\'m trying to add RTL language support in my app (specifically Arabic right now). I\'ll be supporting English as well. What I\'ve done:

  • Set minSdkVersion to 1
2条回答
  •  情歌与酒
    2020-12-14 17:45

    Most obscure bug ever. As I mentioned in the question, most of this code was inherited. It ended up being a bitwise operator issue that was screwing up flags for the application. &= was being used instead of & to check if a flag was set.

    As noted in the comments, the code was taken from an example in an Android Developers blog post, which explains why so many others have run into this same issue. I filed a bug report, and the blog post has since been silently updated. Here is the original code, which I removed &= from. Do not use the following code as is. You need to change &= to &:

    isDebuggable = (appContext.getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    

提交回复
热议问题