大家好
我在将微调器方向设置为RT1时遇到问题。实际上,我的代码无法在支持layoutDirecton的api 17和18中工作,但它在api 27中可以完美工作。
<android.support.v7.widget.AppCompatSpinner
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:layoutDirection="rtl" />
我搜索了互联网,发现ViewCompat类的用法作为无效的解决方案。
如果您能指导我,我将不胜感激
首先确保您在AndroidManifest.xml中启用了rtl支持
<application
...
android:supportsRtl="true"
...>
之后在Spinner定义中使用它:
android:layoutDirection="rtl"
android:textDirection="rtl"