コード例 #1
0
ファイル: TabHost.cs プロジェクト: zhouweiaccp/XobotOS
 /// <summary>Add a tab.</summary>
 /// <remarks>Add a tab.</remarks>
 /// <param name="tabSpec">Specifies how to create the indicator and content.</param>
 public virtual void addTab(android.widget.TabHost.TabSpec tabSpec)
 {
     if (tabSpec.mIndicatorStrategy == null)
     {
         throw new System.ArgumentException("you must specify a way to create the tab indicator."
                                            );
     }
     if (tabSpec.mContentStrategy == null)
     {
         throw new System.ArgumentException("you must specify a way to create the tab content"
                                            );
     }
     android.view.View tabIndicator = tabSpec.mIndicatorStrategy.createIndicatorView();
     tabIndicator.setOnKeyListener(mTabKeyListener);
     // If this is a custom view, then do not draw the bottom strips for
     // the tab indicators.
     if (tabSpec.mIndicatorStrategy is android.widget.TabHost.ViewIndicatorStrategy)
     {
         mTabWidget.setStripEnabled(false);
     }
     mTabWidget.addView(tabIndicator);
     mTabSpecs.add(tabSpec);
     if (mCurrentTab == -1)
     {
         setCurrentTab(0);
     }
 }
コード例 #2
0
ファイル: TabHost.cs プロジェクト: zffl/androidmono
 public virtual void addTab(android.widget.TabHost.TabSpec arg0)
 {
     global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv;
     if (!IsClrObject)
     {
         @__env.CallVoidMethod(this.JvmHandle, global::android.widget.TabHost._addTab12028, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
     else
     {
         @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::android.widget.TabHost.staticClass, global::android.widget.TabHost._addTab12028, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0));
     }
 }
コード例 #3
0
ファイル: TabHost.cs プロジェクト: zhouweiaccp/XobotOS
 public virtual void setCurrentTab(int index)
 {
     if (index < 0 || index >= mTabSpecs.size())
     {
         return;
     }
     if (index == mCurrentTab)
     {
         return;
     }
     // notify old tab content
     if (mCurrentTab != -1)
     {
         mTabSpecs.get(mCurrentTab).mContentStrategy.tabClosed();
     }
     mCurrentTab = index;
     android.widget.TabHost.TabSpec spec = mTabSpecs.get(index);
     // Call the tab widget's focusCurrentTab(), instead of just
     // selecting the tab.
     mTabWidget.focusCurrentTab(mCurrentTab);
     // tab content
     mCurrentView = spec.mContentStrategy.getContentView();
     if (mCurrentView.getParent() == null)
     {
         mTabContent.addView(mCurrentView, new android.view.ViewGroup.LayoutParams(android.view.ViewGroup
                                                                                   .LayoutParams.MATCH_PARENT, android.view.ViewGroup.LayoutParams.MATCH_PARENT));
     }
     if (!mTabWidget.hasFocus())
     {
         // if the tab widget didn't take focus (likely because we're in touch mode)
         // give the current tab content view a shot
         mCurrentView.requestFocus();
     }
     //mTabContent.requestFocus(View.FOCUS_FORWARD);
     invokeOnTabChangeListener();
 }