可以改变ScrollBar的颜色吗?

发布于 2024-12-28 06:22:46 字数 166 浏览 0 评论 0原文

我将 ScrollView 更改

android:fadeScrollbars="false"

为 ScrollBar 可见,并且工作正常。我的问题是可以改变 ScrollBar 的颜色吗? (默认为灰色,我的背景为灰色,因此两者之间的对比度很小)。

I changed in ScrollView

android:fadeScrollbars="false"

to ScrollBar be visible and it works fine. My question is possible to change color of ScrollBar ? ( Default is gray and my background is gray so there is small contrast between ).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

太阳男子 2025-01-04 06:22:46

您可以使用 android:scrollbarThumbVertical="@drawable/youdrawable

在我的例子中,例如 yourdrawable 是:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <gradient android:startColor="#66C0C0C0" android:endColor="#66C0C0C0"
        android:angle="45"/>

    <corners android:radius="6dp" />

</shape>

You can with android:scrollbarThumbVertical="@drawable/youdrawable

In my case, for instance yourdrawable is:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <gradient android:startColor="#66C0C0C0" android:endColor="#66C0C0C0"
        android:angle="45"/>

    <corners android:radius="6dp" />

</shape>
彻夜缠绵 2025-01-04 06:22:46

您可以使用:android:scrollbarThumbVertical="@drawable/yourImage"
,其中“yourImage”可以是您想要的颜色的 2 像素小图像

You can use:android:scrollbarThumbVertical="@drawable/yourImage"
, where 'yourImage' can be a small 2 pixel image of ur desired color

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文