码迷,mamicode.com
首页 > 其他好文 > 详细

ListView修改快速滑动的滑块

时间:2018-02-08 20:09:52      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:scroll   draw   滑动   pre   bdr   call   flat   family   context   

1:如图

技术分享图片

2: ListView加入快速滑动属性

 <ListView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fastScrollEnabled="true"
        android:focusable="true"
        android:overScrollMode="never"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

 3:修改activity的主题

   <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:fastScrollThumbDrawable">@drawable/scroll_block</item>
    </style>

 4:如果是fragment则

   4.1:

 <style name="FragmentTheme1" parent="AppTheme">
        <item name="fragment_color_title">@color/styleColor1</item>
        <item name="android:fastScrollThumbDrawable">@drawable/scroll_block</item>
    </style>

  4.2:

      ctxWithTheme = new ContextThemeWrapper(getActivity().getApplicationContext(), R.style.FragmentTheme1);
        localLayoutInflater = inflater.cloneInContext(ctxWithTheme);
        rootView = (ViewGroup) localLayoutInflater.inflate(R.layout.fragment_song, null, false);

  

ListView修改快速滑动的滑块

标签:scroll   draw   滑动   pre   bdr   call   flat   family   context   

原文地址:https://www.cnblogs.com/galibujianbusana/p/8432342.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!