Cuối cùng, tôi đã đưa ra một giải pháp. Nó chỉ làm việc với API mức 11 hoặc cao hơn
giá trị/style.xml
<style name="AppTheme" parent="@style/Theme.Sherlock.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:fastScrollThumbDrawable">@drawable/fast_thumb</item>
<item name="android:fastScrollTrackDrawable">@drawable/fastscroll_track_default_holo_dark</item>
</style>
Áp dụng hoạt động cho chủ đề này như dưới đây mã:
<activity
android:name="com.example.viewpager.FirstActivity"
android:theme="@style/AppTheme"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Hoạt động bố trí XML như dưới đây mã:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rlScrollingPlayList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical" >
<ListView
android:id="@+id/listView1"
android:layout_width="match_parent"
android:fastScrollEnabled="true"
android:fastScrollAlwaysVisible="true"
android:scrollbarStyle="outsideInset"
android:layout_height="match_parent" >
</ListView>
</RelativeLayout>
Resource tập tin hình ảnh là
nhanh cuộn chọn tập tin thumb XML:
drawable/fast_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/fastscroll_thumb_pressed_holo"/>
<item android:drawable="@drawable/fastscroll_thumb_default_holo"></item>
</selector>
cuối cùng đầu ra như dưới đây con số:
Nguồn
2013-06-27 11:14:14
u có thể bài mã ur? – KOTIOS