项目中有个页面上面是TabLayout下面是Listview,选择TabLayout的选项卡更新下面Listview里面的数据,在请求的时候想禁用TabLayout选项卡来避免用户频繁点击选项卡造成Listview的数据错误。 
       如果只是调用TabLayout的setClickable方法是不起作用的,需要获取到每个选项卡的tabView然后再分别设置。

LinearLayout tabStrip = (LinearLayout) tabLayout.getChildAt(0);
for (int i = 0; i < tabStrip.getChildCount(); i++) {
    View tabView = tabStrip.getChildAt(i);
    if (tabView != null) {
        tabView.setClickable(false);
    }
}

 

相关文章:

  • 2021-10-07
  • 2021-08-27
  • 2021-05-08
  • 2021-09-15
  • 2022-12-23
  • 2021-12-20
  • 2021-09-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2021-11-05
  • 2021-09-18
  • 2021-10-26
相关资源
相似解决方案