仅在触摸Listview上显示滚动

时间:2017-03-23 00:06:48

标签: android listview

我希望在触摸列表视图时显示滚动,并且在未触摸时想要消失,而不管列表视图中的项目数量。

这是我目前的代码段

case

我的styles.xml如下所示:

select 
    t.id
  , t.date
  , IsBetween = case 
          when t.date between x.Date1 and x.Date2
            then 1
          when x.id is null
            then null
          else 0
          end
from table_1 t
  outer apply (
    select top 1 t2.*
    from table_2 t2
    order by case 
      when t.date between t2.Date1 and t2.Date2 
        then 0
      else 1
      end
  ) as x

使用fastScrollAlwaysVisible我只能将其设置为始终显示或不显示。我怎样才能实现我想要的,只有在触摸列表视图时才会显示。

1 个答案:

答案 0 :(得分:0)

在您的主题中进行以下覆盖:

<style name="Theme.App" parent="android:Theme.Light">
    <item name="android:fadeScrollbars">true</item>
 </style>

见第一个答案:

Autohide scrollbars when not scrolling in a ListView

注意:只有当您有多个项目(超过全屏幕)时才会显示淡化滚动条。替代方案是做相反的事情 - &gt;滚动条始终可见(How to always show scrollbar

最后一个可能的解决方案是创建自定义列表视图(从ListView扩展)并以某种方式访问​​滚动条的机制

相关问题