我们可以在Android中停止evrencoskun TableView垂直滚动吗?

时间:2018-10-08 07:11:34

标签: android tableview

 mTableView.setShadowColor(0);
 mTableView.setShowVerticalSeparators(false);

我们是否有任何属性可以停止TableView中的垂直滚动。如上图所示。

谢谢。

1 个答案:

答案 0 :(得分:0)

我不知道您为什么需要这样的东西。但是您可以通过为CellRecyclerViewRowHeaderRecyclerView设置自定义layoutManager来做到这一点。

创建自己的布局管理器

    MyCellLayoutManager extends CellLayoutManager{
    ...

     @Override
     public boolean canScrollVertically() {
      return false;
     }
    }

对于RowHeader

   MyRowHeaderLayoutManager extends LinearLayoutManager{
    MyRowHeaderLayoutManager(Context context){
     super(context, LinearLayoutManager.VERTICAL, false);
    }
    ...

     @Override
     public boolean canScrollVertically() {
      return false;
     }
    }

并将它们设置为相关的RecyclerViews

tableView.getCellRecyclerView().setLayoutManager(new MyCellLayoutManager());
tableView.getRowHeaderRecyclerView().setLayoutManager(new MyRowHeaderLayoutManager());
相关问题