android - 在 ScrollView 中更改滚动条的颜色

标签 android android-studio android-scrollview

使用 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/

相关文章:

android - 构建 apk 失败,错误为 : package android. arch.core.util 不存在

android - 如何将动态创建的LinearLayout添加到ScrollView中?

android - 如何制作可缩放的 ScrollView ?

android - 在 Container 中通过标签名查找 Fragment

安卓 Material : Status bar color won't change

android - Gradle git 依赖项

android - 在Android Studio中安装ActionBarSherlock 4.4

android - afreechart - ScrollView 中的图表

java - 如何在运行时更改 AndroidManifest?

java - 如何访问数组名称以获得列表?