使用 drawable
文件更改 ScrollView
中滚动条的颜色后,更改在预览和设计中可见,但在我的手机上不可见。
ScrollView
fragment
<ScrollView
android:layout_width="368dp"
android:layout_height="150dp"
android:layout_marginTop="8dp"
android:scrollbarThumbVertical="@drawable/scollbar"
android:scrollbarTrackVertical="@color/colorPrimaryDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
android:scrollbarSize="4dp"
android:scrollbarAlwaysDrawVerticalTrack="true"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintVertical_bias="0.313">
<LinearLayout>
<TextView></TextView>
</LinearLayout>
</ScollView>
android:scrollbarThumbVertical
中的 scollbar
不是拼写错误。
谢谢。
最佳答案
检查预览设备和您的设备的 API 版本。可能不一样。然后检查可绘制文件和您的设备的兼容性。您应该使所有设备兼容的可绘制文件具有属性以在所有设备中应用更改。
关于android - 在 ScrollView 中更改滚动条的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52901863/