private void addTab(int index, string text, int iconResId) { TabView tabView = new TabView(this); tabView.mIndex = index; tabView.Focusable = true; tabView.SetOnClickListener(mTabClickListener); tabView.Text = text; if (iconResId != 0) { tabView.SetCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0); } mTabLayout.AddView(tabView, new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MatchParent, 1)); }