【问题标题】:ActionBar-PullToRefresh exclude part of view pull to refreshActionBar-PullToRefresh 排除部分视图拉刷新
【发布时间】:2014-03-18 02:38:00
【问题描述】:

我想为列表视图添加拉动刷新功能,但是在列表视图标题中,有一个视图寻呼机,视图寻呼机水平滚动,我不希望列表视图标题响应拉动刷新事件,因为标题是列表视图的一部分,所以我不能使用函数 theseChildrenArePullable(),有没有提供的解决方案?

【问题讨论】:

    标签: android android-actionbar pull-to-refresh


    【解决方案1】:

    如果您使用的是 Chris Banes 的 PTR:

    https://github.com/chrisbanes/ActionBar-PullToRefresh

    你可以设置可拉的孩子:

    ActionBarPullToRefresh.from(getActivity())
           // Here you can mark what views are pullable
           .theseChildrenArePullable(android.R.id.list, android.R.id.empty)
           .listener(this) //Activity implements on refresh listener
           .setup(mPullToRefreshLayout);
    

    【讨论】:

    • 嗨@Kenan Begic,看起来你不理解我,这些ChildrenArePullable(android.R.id.list, android.R.id.empty) 只包含一些视图,我需要排除一些视图,在我的问题中,listview 标头是 listview 的一部分,所以我不能使用 theseChildrenArePullable()
    • 我明白了,所以您有包含 listView 的 PTR 并且该 listview 包含您不想被拉取的视图寻呼机?这个视图传呼机一定是一些突发新闻或某事水平滚动,为什么你不希望它是可拉动的?
    • 虽然PTR监听的是垂直触摸事件,但是它很敏感,当我水平触摸滚动查看器时经常打扰我,这是一个非常糟糕的用户体验。
    • 所以问题是ptr/pager的垂直/水平拉/滚动?
    • 我只希望listview header不响应PTR触摸事件
    【解决方案2】:

    好的,根据我的要求,我fork PTR项目,并在https://github.com/yingchn/ActionBar-PullToRefresh处添加函数。

    我已经创建了一个合并原始项目的拉取请求,请参阅https://github.com/chrisbanes/ActionBar-PullToRefresh/pull/283

    希望对你有用

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-18
      • 2012-08-22
      • 2014-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多