0
ツールバーを使用するにはテーマを設定する必要があるので(android:theme="@style/Theme.AppCompat.NoActionBar"
)、カスタムのスクロールサムが必要とするため、テーマを使用する必要があるかどうかはわかりません設定するテーマ。私の場合はandroid:theme="@style/GreenTheme"
を使用しましたが、まだアクティビティ用のツールバーが必要です。これはどのように達成できますか?カスタムファーストスクロールをツールバーを含むアクティビティで使用する方法
Mainfestファイル(アクティビティ宣言)
<activity
android:name=".MainActivity"
android:label="@string/main_activity"
android:theme="@style/Theme.AppCompat.NoActionBar" />
のstyles.xml(高速スクロールの宣言)、高速スクロールと
<style name="GreenTheme" parent="AppTheme">
<item name="android:fastScrollPreviewBackgroundRight">@drawable/fastscrollpreview_green</item>
<item name="android:fastScrollOverlayPosition">atThumb</item>
<item name="android:fastScrollThumbDrawable">@drawable/fastscrollthumb_green</item>
<item name="android:fastScrollTextColor">#FFF</item>
</style>
リストビュー
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:choiceMode="singleChoice"
android:fastScrollEnabled="true"
android:scrollbarThumbVertical="@drawable/scrollbar_white" />
</LinearLayout>