android - 如何更改 ScrollView android 中实际滚动的颜色?

标签 android android-layout scrollview android-xml

我想知道是否可以更改 ScrollView 的颜色。

我不是指背景颜色或边缘。
我附上了我所指的酒吧的打印屏幕。对我来说,这有点透明。

这是我在 xml 中定义它的方式:

<ScrollView  
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:fadeScrollbars="false"
    android:layout_toLeftOf="@+id/personalscores_BackButton" 
    android:layout_marginRight="0dp" > 

scroll bar

最佳答案

使用这个在drawable(scrollbar.xml)中创建一个滚动条

<shape android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
         android:angle="45"
         android:centerColor="#65FF8215"
         android:endColor="#87FD2125"
         android:startColor="#65FF8215" />
    <corners android:radius="20dp" />
</shape>

并将像 android:scrollbarThumbVertical="@drawable/scrollbar" 这样的滚动条添加到您的 ListView

将以下属性添加到您的布局中

android:scrollbarThumbVertical="@android:color/white"

创建一个图像并将其放入drawable中。然后将以下属性添加到您的布局中

android:scrollbarThumbVertical="@drawable/scroll_bar_vertical"

关于android - 如何更改 ScrollView android 中实际滚动的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20781788/

相关文章:

android - ScrollView diorders 并移除 relativelayout 的内容

android - "Gradle sync failed: No installed build tools found. Install the Android build tools version 19.1.0 or higher"

android - 工具栏中的自定义布局未显示

android - Android App 中的后退按钮无法退出应用程序

android - 在运行时在已经膨胀的层次结构中添加 View /布局?

android - 以编程方式在线性布局中添加表格布局

qt - 如何给垂直滚动条和滚动区域添加鼠标滚轮滚动?

ios - 使用自动布局增加 ScrollView 中的 View 高度

android - 未调用自定义适配器 getview

java - 安卓应用在后台