Android Material 从最大到最小的滑块
Android Material Slider from Max to Min
这是一个有点简单的问题,但不幸的是我没有找到任何信息。
我需要将滑块设置为最大值,以便用户向左滑动到最小值。
这是默认行为:
这就是我想要的:
您可以使用 layoutDirection
的 属性
<com.google.android.material.slider.Slider
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:valueFrom="0"
android:valueTo="100"
android:layoutDirection="rtl"/>
或者如果您想将最大值设置为默认值:
<com.google.android.material.slider.Slider
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:valueFrom="0"
android:valueTo="100"
android:value="100"/>
这是一个有点简单的问题,但不幸的是我没有找到任何信息。
我需要将滑块设置为最大值,以便用户向左滑动到最小值。
这是默认行为:
这就是我想要的:
您可以使用 layoutDirection
的 属性<com.google.android.material.slider.Slider
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:valueFrom="0"
android:valueTo="100"
android:layoutDirection="rtl"/>
或者如果您想将最大值设置为默认值:
<com.google.android.material.slider.Slider
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:valueFrom="0"
android:valueTo="100"
android:value="100"/>