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" />