Listening for changes

RadTabView Beta will notify its TabViewChangeListener objects before and after a tab selection occurs. Also the listeners will be asked for a tab's content view if it does not have one.

Here is an example implementation of the selection notifications:

@Override
public boolean onSelectingTab(Tab tabToSelect) {
    // Cancel selection of the middle tab.
    return tabToSelect == this.tabView.getTabs().get(1);
}

@Override
public void onTabSelected(Tab selectedTab, Tab deselectedTab) {
    if(deselectedTab != null) {
        Log.d("TabView deselected: ", deselectedTab.getTitle());
    }
    Log.d("TabView selected: ", selectedTab.getTitle());
}

Content view callback example:

@Override
public View getContentViewForTab(Tab tab) {
    TextView contentView = new TextView(this.getContext());
    contentView.setText(tab.getTitle() + " content view");
    contentView.setGravity(Gravity.CENTER);

    return contentView;
}
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy