public override void addTab(android.app.ActionBar.Tab tab, bool setSelected) { ensureTabsExist(); mTabScrollView.addTab(tab, setSelected); configureTab(tab, mTabs.size()); if (setSelected) { selectTab(tab); } }
public TabView(ScrollingTabContainerView _enclosing, android.content.Context context , android.app.ActionBar.Tab tab, bool forList) : base(context, null, [email protected] .attr.actionBarTabStyle) { this._enclosing = _enclosing; this.mTab = tab; if (forList) { this.setGravity(android.view.Gravity.LEFT | android.view.Gravity.CENTER_VERTICAL); } this.update(); }
private void configureTab(android.app.ActionBar.Tab tab, int position) { [email protected] tabi = ([email protected] .TabImpl)tab; android.app.ActionBar.TabListener callback = tabi.getCallback(); if (callback == null) { throw new System.InvalidOperationException("Action Bar Tab must have a Callback"); } tabi.setPosition(position); mTabs.add(position, tabi); int count = mTabs.size(); { for (int i = position + 1; i < count; i++) { mTabs.get(i).setPosition(i); } } }
public virtual void addTab(android.app.ActionBar.Tab tab, bool setSelected_1) { [email protected] tabView = createTabView (tab, false); mTabLayout.addView(tabView, new android.widget.LinearLayout.LayoutParams(0, android.view.ViewGroup .LayoutParams.MATCH_PARENT, 1)); if (mTabSpinner != null) { (([email protected])mTabSpinner.getAdapter ()).notifyDataSetChanged(); } if (setSelected_1) { tabView.setSelected(true); } if (mAllowCollapse) { requestLayout(); } }
private [email protected] createTabView( android.app.ActionBar.Tab tab, bool forAdapter) { [email protected] tabView = new [email protected] .TabView(this, getContext(), tab, forAdapter); if (forAdapter) { tabView.setBackgroundDrawable(null); tabView.setLayoutParams(new android.widget.AbsListView.LayoutParams(android.view.ViewGroup .LayoutParams.MATCH_PARENT, mContentHeight)); } else { tabView.setFocusable(true); if (mTabClickListener == null) { mTabClickListener = new android.widget.@internal.ScrollingTabContainerView.TabClickListener (this); } tabView.setOnClickListener(mTabClickListener); } return(tabView); }
public override void selectTab(android.app.ActionBar.Tab tab) { if (getNavigationMode() != NAVIGATION_MODE_TABS) { mSavedTabPosition = tab != null?tab.getPosition() : INVALID_POSITION; return; } android.app.FragmentTransaction trans = mActivity.getFragmentManager().beginTransaction ().disallowAddToBackStack(); if (mSelectedTab == tab) { if (mSelectedTab != null) { mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans); mTabScrollView.animateToTab(tab.getPosition()); } } else { mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : android.app.ActionBar .Tab.INVALID_POSITION); if (mSelectedTab != null) { mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans); } mSelectedTab = ([email protected])tab; if (mSelectedTab != null) { mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans); } } if (!trans.isEmpty()) { trans.commit(); } }
public abstract void selectTab(android.app.ActionBar.Tab tab);
public abstract void removeTab(android.app.ActionBar.Tab tab);
public abstract void addTab(android.app.ActionBar.Tab tab, int position, bool setSelected );
public abstract void addTab(android.app.ActionBar.Tab tab, int position);
public abstract void addTab(android.app.ActionBar.Tab tab);
public virtual void update() { android.app.ActionBar.Tab tab = this.mTab; android.view.View custom = tab.getCustomView(); if (custom != null) { this.addView(custom); this.mCustomView = custom; if (this.mTextView != null) { this.mTextView.setVisibility(android.view.View.GONE); } if (this.mIconView != null) { this.mIconView.setVisibility(android.view.View.GONE); this.mIconView.setImageDrawable(null); } } else { if (this.mCustomView != null) { this.removeView(this.mCustomView); this.mCustomView = null; } android.graphics.drawable.Drawable icon = tab.getIcon(); java.lang.CharSequence text = tab.getText(); if (icon != null) { if (this.mIconView == null) { android.widget.ImageView iconView = new android.widget.ImageView(this.getContext( )); android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams (android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams .WRAP_CONTENT); lp.gravity = android.view.Gravity.CENTER_VERTICAL; iconView.setLayoutParams(lp); this.addView(iconView, 0); this.mIconView = iconView; } this.mIconView.setImageDrawable(icon); this.mIconView.setVisibility(android.view.View.VISIBLE); } else { if (this.mIconView != null) { this.mIconView.setVisibility(android.view.View.GONE); this.mIconView.setImageDrawable(null); } } if (text != null) { if (this.mTextView == null) { android.widget.TextView textView = new android.widget.TextView(this.getContext(), null, [email protected]); textView.setEllipsize(android.text.TextUtils.TruncateAt.END); android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams (android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams .WRAP_CONTENT); lp.gravity = android.view.Gravity.CENTER_VERTICAL; textView.setLayoutParams(lp); this.addView(textView); this.mTextView = textView; } this.mTextView.setText(text); this.mTextView.setVisibility(android.view.View.VISIBLE); } else { if (this.mTextView != null) { this.mTextView.setVisibility(android.view.View.GONE); this.mTextView.setText(null); } } if (this.mIconView != null) { this.mIconView.setContentDescription(tab.getContentDescription()); } } }
public virtual void bindTab(android.app.ActionBar.Tab tab) { this.mTab = tab; this.update(); }
public override void addTab(android.app.ActionBar.Tab tab, int position) { addTab(tab, position, mTabs.isEmpty()); }
public override void addTab(android.app.ActionBar.Tab tab) { addTab(tab, mTabs.isEmpty()); }
public override void removeTab(android.app.ActionBar.Tab tab) { removeTabAt(tab.getPosition()); }