Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 更改ListView';s滚动条/快速滚动颜色?_Android_Android Listview_Material Design - Fatal编程技术网

Android 更改ListView';s滚动条/快速滚动颜色?

Android 更改ListView';s滚动条/快速滚动颜色?,android,android-listview,material-design,Android,Android Listview,Material Design,我的应用程序有一个橙色的主题,但滚动条/快速滚动显示为绿色。我已经试着搜索了很多,但找不到任何方法来改变这一点。它只是保持原样 我发现了一个“android:fastScrollTextColor”属性,但它改变了气泡中B的颜色。我找不到任何属性来更改这个气泡的颜色或它旁边的滚动条 如果有区别,我将使用从中获得的自定义PinnedHeaderListView来模拟棒棒糖联系人应用程序中的粘性标题。在xml文件中的listView属性中设置此属性 android:scrollbarSize="1

我的应用程序有一个橙色的主题,但滚动条/快速滚动显示为绿色。我已经试着搜索了很多,但找不到任何方法来改变这一点。它只是保持原样

我发现了一个“android:fastScrollTextColor”属性,但它改变了气泡中B的颜色。我找不到任何属性来更改这个气泡的颜色或它旁边的滚动条


如果有区别,我将使用从中获得的自定义PinnedHeaderListView来模拟棒棒糖联系人应用程序中的粘性标题。

在xml文件中的listView属性中设置此属性

android:scrollbarSize="10dp"
android:scrollbarThumbVertical="@drawable/custom_scroll_style"
这里的custom_scroll_样式是drawable文件夹下的xml文件。让我们创建自定义\u滚动\u style.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<gradient
    android:angle="45"
    android:endColor="@color/endColor" //define what you want
    android:centerColor="@color/centercolor"
    android:startColor="@color/startColor" />

<corners android:radius="8dp" />
<size android:width="4dp"/>
<padding
    android:left="0.5dp"
    android:right="0.5dp" />

</shape>


希望有帮助

滚动条拇指颜色设置为应用程序主题中的
android:colorAccent
属性。你确定这是设定好的并且是正确的,对吗

请注意,如果使用AppCompat,则必须从属性中排除
android:
前缀


您可以找到有关可用颜色属性的更多信息。

android:ScrollBart
可以正常工作。但是如果在
listView
中启用了fastcroll,您应该在
AppTheme
或任何主题中定义
android:fastcrollThumbDrawable
,并将其用于包含启用了fastcroll的listView的活动(在
AndroidManifest

styles.xml的一部分

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:fastScrollThumbDrawable">@drawable/fast_scrollbar_vertical</item>
</style>

@颜色/颜色重音
@可绘制/快速滚动条垂直
部分舱单

    <activity
        android:name=".ListActivity"
        android:label="@string/title_activity_list"
        android:theme="@style/AppTheme" />

和滚动条绘制应该是梯度

<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<gradient
    android:angle="45"
    android:endColor="@color/scroll_color"
    android:centerColor="@color/scroll_color"
    android:startColor="@color/scroll_color" />

<corners android:radius="8dp" />
<size android:width="8dp" android:height="100dp"/>
<padding
    android:left="0.5dp"
    android:right="0.5dp" />

</shape>


试过了。。还是一样。没有效果..:(这是我100%测试的结果…无论如何..看看你的项目…会有一些改变它的东西…会有一些.xml布局文件呈现那个东西。你只需要找到它并改变它。它成功了。这是我的错误,我没有设置重音颜色..谢谢你的帮助!有没有办法设置android:scrollbarThumbVertical=“@可绘制/自定义\u滚动\u样式"从java方面/以编程方式?我有一个自定义的listView,在Focus上,我希望它更改滚动条的颜色。我相信滚动条的拇指颜色设置为主题中的
colorAccent
属性。你确定设置正确,对吗?这就成功了。哇,我甚至不知道有一个东西叫accent co我还以为这只是PrimaryColor和PrimaryColorDark。我是新手。谢谢你的帮助:)嘿,如何在列表视图中实现这一点?