zcweng / SwitchButton

SwitchButton.An beautiful+lightweight+custom-style-easy switch widget for Android,minSdkVersion >= 11
https://github.com/zcweng/SwitchButton
MIT License
2.67k stars 415 forks source link

Add support for RTL layout #48

Open BloCamLimb opened 3 years ago

BloCamLimb commented 3 years ago

Your code shows that only when button thumb is visually on the left, it's unchecked. But in RTL layout, it should be resolved on the opposite side. This leads to poor compatibility for internationalization purposes. You may check isLayoutRtl() first just like Android's Switch.

您的代码显示,只有当按钮拇指在视觉上位于左侧时,它才处于未选中状态。但在RTL布局中,它应该解析在另一侧。这导致国际化方面的兼容性很差。您可以像 Android 的 Switch 一样,先判断 isLayoutRtl()