NativeScript How to hide tab buttons from TabView

梦想与她 提交于 2019-12-24 09:05:58

问题


I've got a TabView in my NativeScript page. The tabs content is programmatically populated.

How to hide / collapse the tabs buttons (because the tabs are switched programmatically)?

see Image above of TabView buttons bar - which needs to be collapsed


回答1:


You can try

For ios:

var myTabView = page.getViewById("myTabView")
myTabView.ios.tabBar.hidden = true;

For android

myTabView.android.removeViewAt(1);



回答2:


A better solution for android (I hope i translated it correctly from my working nativescript angular code)

  const tabLayout = myTabView.android.tabLayout;

  // use native android methods to hide the tabLayout containing the tab buttons
  if(isFullscreen) {
    tabLayout.setVisibility(android.view.View.GONE);
  } else {
    tabLayout.setVisibility(android.view.View.VISIBLE);
  }


来源:https://stackoverflow.com/questions/40367926/nativescript-how-to-hide-tab-buttons-from-tabview

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!