Android的列表视图快速滚动的定制问题 [英] android listview fast scroll customization issue

查看:141
本文介绍了Android的列表视图快速滚动的定制问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的列表视图

<ListView android:layout_width="match_parent"
            android:layout_height="match_parent" android:id="@+id/ListView"
            android:fastScrollEnabled="true" android:divider="@null"
            style="@drawable/listviewfastscrollstyle"
            ></ListView>

这是listviewfastscrollstyle样式文件

This is listviewfastscrollstyle style file

<style> 
<item name="android:fastScrollTrackDrawable">@drawable/listselector</item> 
<item name="android:fastScrollThumbDrawable">@drawable/listselector</item> 
</style>

这是listselector文件

This is listselector file

<selector xmlns:android="http://schemas.android.com/apk/res/android">
 <item android:state_pressed="true" android:drawable="@drawable/channelarrows_down" /> 
 <item android:drawable="@drawable/minimize" /> 
 </selector>

不过还是列表视图中快速滚动条不获取定制的。

But still the list view fast scroll bar is not getting customized.

推荐答案

您创建的风格是不正确的。你需要给它一个名字。我不知道发生了什么事这个您的最后一个职位。执行以下操作:

The style you created isn't correct. You need to give it a name. I'm not sure what happened to your last post about this. Do the following:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="listviewfastscrollstyle" parent="android:Theme">
    <item name="android:fastScrollTrackDrawable">@drawable/listselector</item>
    <item name="android:fastScrollThumbDrawable">@drawable/listselector</item>
</style>

</resources>

在你的清单一套这样的风格:

In your Manifest set the style like this:

<application 
    android:icon="@drawable/icon" 
    android:label="@string/app_name" 
    android:theme="@style/CustomTheme">

根据要求,这是我在测试上的ListView控件:

As requested, this is the ListView I was testing on:

<ExpandableListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:layout_weight="1"
    android:drawSelectorOnTop="false"
    android:fastScrollAlwaysVisible="true"
    android:fastScrollEnabled="true"
    android:indicatorLeft="8dip"
    android:indicatorRight="52dip"
    android:paddingRight="32dip" />

这篇关于Android的列表视图快速滚动的定制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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