如何自定义GridView垂直滚动条? [英] How to customize GridView vertical scrollbar?

查看:489
本文介绍了如何自定义GridView垂直滚动条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



  android:scrollbarThumbVertical =@ drawable / scrollbar_vertical_thumb
android: scrollbarTrackVertical =@ drawable / scrollbar_vertical_track

scrollbar_vertical_thumb.xml

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

< gradient
android:angle =0
android:endColor =#005A87
android:startColor =#007AB8/>

<角落android:radius =6dp/>

< / shape>

scrollbar_vertical_track.xml

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

< gradient
android:angle =0
android:endColor =#9BA3C5
android:startColor =#8388A4/>

<角落android:radius =6dp/>

< / shape>

但它不起作用,gridview不断显示原始滚动条。



  android:scrollbarAlwaysDrawVerticalTrack = true 
android:scrollbars = vertical

如果没有成功,请尝试 android:scrollbarSize


I tried changing scrollbar of GridView:

android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"

scrollbar_vertical_thumb.xml

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

    <gradient
        android:angle="0"
        android:endColor="#005A87"
        android:startColor="#007AB8" />

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

</shape>

scrollbar_vertical_track.xml

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

    <gradient
        android:angle="0"
        android:endColor="#9BA3C5"
        android:startColor="#8388A4" />

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

</shape>

But it's not working and gridview keeps showing original scrollbar.

解决方案

please try

android:scrollbarAlwaysDrawVerticalTrack=true
           android:scrollbars=vertical

if it didnt work then try android:scrollbarSize too

这篇关于如何自定义GridView垂直滚动条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆