private void button_history_Click(object sender, EventArgs e) { Contart data = new Contart(); data.LastMessage = "3月1日"; data.LastMessageTime = DateTime.Now; data.NickName = "1.0.0.1 版本更新"; viewAdapter.Add(data); data = new Contart(); data.LastMessage = "3月7日"; data.LastMessageTime = DateTime.Now; data.NickName = "1.0.0.2 版本更新"; viewAdapter.Add(data); data = new Contart(); data.LastMessage = "3月15日"; data.LastMessageTime = DateTime.Now; data.NickName = "1.0.0.3 版本更新"; viewAdapter.Add(data); data = new Contart(); data.LastMessage = "3月26日"; data.LastMessageTime = DateTime.Now; data.NickName = "1.0.0.4 版本更新"; viewAdapter.Add(data); data = new Contart(); data.LastMessage = "4月10日"; data.LastMessageTime = DateTime.Now; data.NickName = "1.0.0.5 版本更新"; viewAdapter.Add(data); TabWidget.SelectTab(history_page); }
public TabVBox(ITdiTab tabWidget, ITDIWidgetResolver widgetResolver) { tab = tabWidget; titleLabel = new Label(); if (tab is ITdiTabWithPath) { (tab as ITdiTabWithPath).PathChanged += OnPathUpdated; OnPathUpdated(null, EventArgs.Empty); } else { tab.TabNameChanged += Tab_TabNameChanged; Tab_TabNameChanged(null, null); } this.PackStart(titleLabel, false, true, 2); TabWidget = widgetResolver.Resolve(tabWidget); if (TabWidget == null) { throw new InvalidCastException($"Ошибка приведения типа {nameof(ITdiTab)} к типу {nameof(Widget)}."); } this.Add(TabWidget); titleLabel.Show(); TabWidget.Show(); }
/// <summary> /// Called on activity creation. /// </summary> /// <param name="bundle">Bundle.</param> protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.History); Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); DisplayMetrics metrics = Resources.DisplayMetrics; int widthInDp = metrics.WidthPixels; tabH = FindViewById <TabHost> (Android.Resource.Id.TabHost); tabH.LayoutParameters.Width = (int)(widthInDp * TAB_WIDTH); tabW = FindViewById <TabWidget> (Android.Resource.Id.Tabs); back = FindViewById <Button> (Resource.Id.backHistory); back.Click += Back; delete = FindViewById <Button> (Resource.Id.Delete); delete.Click += Delete; CreateTab(typeof(LastGame), "last_game", "Last Game"); CreateTab(typeof(AllGames), "all_games", "All Games"); CreateTab(typeof(Points), "points", "Points"); }
public void OnPageSelected(int position) { // Unfortunately when TabHost changes the current tab, it kindly // also takes care of putting focus on it when not in touch mode. // The jerk. // This hack tries to prevent this from pulling focus out of our // ViewPager. TabWidget widget = mTabHost.GetTabWidget(); int oldFocusability = widget.GetDescendantFocusability(); widget.SetDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS); mTabHost.SetCurrentTab(position); widget.SetDescendantFocusability(oldFocusability); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.activity_starred); ActivityHelper.SetupActionBar (new Java.Lang.String (Title), new Color (0)); mTabHost = FindViewById<TabHost> (Android.Resource.Id.TabHost); mTabWidget = FindViewById<TabWidget> (Android.Resource.Id.Tabs); mTabHost.Setup (); SetupSessionsTab (); SetupVendorsTab (); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_starred); ActivityHelper.SetupActionBar(new Java.Lang.String(Title), new Color(0)); mTabHost = FindViewById <TabHost> (Android.Resource.Id.TabHost); mTabWidget = FindViewById <TabWidget> (Android.Resource.Id.Tabs); mTabHost.Setup(); SetupSessionsTab(); SetupVendorsTab(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Intent intent = Intent; mQuery = intent.GetStringExtra(SearchManager.Query); SetContentView(Resource.Layout.activity_search); ActivityHelper.SetupActionBar(new Java.Lang.String(Title), new Color(0)); var title = GetString(Resource.String.title_search_query, mQuery); ActivityHelper.SetActionBarTitle(new Java.Lang.String(title)); mTabHost = FindViewById <TabHost> (Android.Resource.Id.TabHost); mTabWidget = FindViewById <TabWidget> (Android.Resource.Id.Tabs); mTabHost.Setup(); SetupSessionsTab(); SetupVendorsTab(); }
public override void Destroy() { TabWidget.Destroy(); base.Destroy(); }
public BadgeView(Context context, TabWidget target, int index) : this(context, null, Android.Resource.Attribute.TextViewStyle, target, 0) { }
private Task <IDialogAnswer <DateTime> > ShowDateTimeDialog(string caption, DateTime current, bool date, bool time , IDialogButton positive, IDialogButton negative) { var tsc = new TaskCompletionSource <IDialogAnswer <DateTime> >(); var builder = CreateBuilder(); builder.SetTitle(caption); using (var th = new TabHost(_activity)) { th.Id = Android.Resource.Id.TabHost; var widget = new TabWidget(_activity) { Id = Android.Resource.Id.Tabs }; var fl = new FrameLayout(_activity) { Id = Android.Resource.Id.TabContent }; var rll = new LinearLayout(_activity) { Orientation = Orientation.Vertical }; rll.SetBackgroundColor(new Color(50, 100, 145)); rll.AddView(widget); rll.AddView(fl); fl.LayoutParameters.Width = ViewGroup.LayoutParams.MatchParent; th.AddView(rll); th.Setup(); var tabContentFactory = new TabContentFactory(); if (date) { var dp = new DatePicker(_activity) { Id = DatePicker }; var minDate = new DateTime(1900, 1, 1); current = current > minDate ? current : minDate; dp.DateTime = current; tabContentFactory.Add("date", dp); var spec = th.NewTabSpec("date"); spec.SetContent(tabContentFactory); spec.SetIndicator(CreateTabIndicator(D.DATE)); th.AddTab(spec); } if (time) { var tp = new TimePicker(_activity) { Id = TimePicker }; tp.SetIs24HourView(new Java.Lang.Boolean(true)); tp.CurrentHour = new Java.Lang.Integer(current.Hour); tp.CurrentMinute = new Java.Lang.Integer(current.Minute); tabContentFactory.Add("time", tp); var spec = th.NewTabSpec("time"); spec.SetContent(tabContentFactory); spec.SetIndicator(CreateTabIndicator(D.TIME)); th.AddTab(spec); } widget.SetCurrentTab(0); builder.SetView(th); } builder.SetPositiveButton(positive.Caption, (sender, e) => { DateTime result = DateTimeFromDialog(sender, current, date, time); tsc.SetResult(new DialogAnswer <DateTime>(true, result)); }); builder.SetNegativeButton(negative.Caption, (sender, e) => { DateTime result = DateTimeFromDialog(sender, current, date, time); tsc.SetResult(new DialogAnswer <DateTime>(false, result)); }); builder.SetCancelable(false); ShowDialog(builder); return(tsc.Task); }
// http://www.techwavedev.com/?p=14 // http://www.androidhive.info/2011/08/android-tab-layout-tutorial/ // http://stackoverflow.com/questions/6685257/android-tabhost-addtab-null-pointer-exception // http://stackoverflow.com/questions/6674044/android-application-is-not-runnning-errorresourcesnotfoundexception-resource // http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/TabHost.java.shtml protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://www.dreamincode.net/forums/topic/130521-android-part-iii-dynamic-layouts/ base.onCreate(savedInstanceState); var c = this; var th = new TabHost(c); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); th.addView(ll); var tw = new TabWidget(c); tw.setId(android.R.id.tabs); tw.AttachTo(ll); var fl = new FrameLayout(c); fl.setId(android.R.id.tabcontent); fl.AttachTo(ll); //th.str this.setContentView(th); // Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabs' // what? // android.widget.TabHost cannot be cast to android.widget.TabWidget th.setup(); // for some reason R.layout.tab_indicator cannot be loaded and causes a fault! // http://www.devdaily.com/java/jwarehouse/android/core/java/android/widget/TabHost.java.shtml // http://ericharlow.blogspot.com/2010/10/experience-customizing-androids-tab.html { var a = new TextView(c); a.setText("Hello1"); var ts = th .newTabSpec("") .setIndicator( a //(CharSequence)(object)"Hello" //, res.getDrawable(R.drawable.ic_tab_main) ) .setContent( new XTabContentFactory { c = this } ); //E/AndroidRuntime( 1610): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0 //E/AndroidRuntime( 1610): at android.content.res.Resources.getValue(Resources.java:1018) //E/AndroidRuntime( 1610): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2105) //E/AndroidRuntime( 1610): at android.content.res.Resources.getLayout(Resources.java:857) //E/AndroidRuntime( 1610): at android.view.LayoutInflater.inflate(LayoutInflater.java:394) //E/AndroidRuntime( 1610): at android.widget.TabHost$LabelIndicatorStrategy.createIndicatorView(TabHost.java:531) //E/AndroidRuntime( 1610): at android.widget.TabHost.addTab(TabHost.java:223) //E/AndroidRuntime( 1610): at AndroidTabViewActivity.Activities.ApplicationActivity.onCreate(ApplicationActivity.java:54) th.addTab(ts ); } { var a = new TextView(c); a.setText("Hello2"); var ts = th .newTabSpec("") .setIndicator( a //(CharSequence)(object)"Hello" //, res.getDrawable(R.drawable.ic_tab_main) ) .setContent( new YTabContentFactory { c = this } ); //E/AndroidRuntime( 1610): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0 //E/AndroidRuntime( 1610): at android.content.res.Resources.getValue(Resources.java:1018) //E/AndroidRuntime( 1610): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2105) //E/AndroidRuntime( 1610): at android.content.res.Resources.getLayout(Resources.java:857) //E/AndroidRuntime( 1610): at android.view.LayoutInflater.inflate(LayoutInflater.java:394) //E/AndroidRuntime( 1610): at android.widget.TabHost$LabelIndicatorStrategy.createIndicatorView(TabHost.java:531) //E/AndroidRuntime( 1610): at android.widget.TabHost.addTab(TabHost.java:223) //E/AndroidRuntime( 1610): at AndroidTabViewActivity.Activities.ApplicationActivity.onCreate(ApplicationActivity.java:54) th.addTab(ts ); } //th.addTab(th // .newTabSpec("") // .setIndicator( // (CharSequence)(object)"World" // //, res.getDrawable(R.drawable.ic_tab_setup) // ) // .setContent(new Intent(c, GetMainActivityClass())) //); this.ShowLongToast("http://jsc-solutions.net"); }
public BadgeView (Context context, TabWidget target, int index) : this(context, null, Android.Resource.Attribute.TextViewStyle, target, 0) { }