2013-12-16 74 views
0

我想爲TabHost中的每個選項卡添加背景。Xamarin:爲每個選項卡設置不同的背景(在TabHost中)

private void CreateTab(Type activityType, string tag, string label, int drawableId) 
    { 
     TabHost.TabSpec spec; 

     var intent = new Intent(this, activityType); 
     intent.AddFlags(ActivityFlags.NewTask); 

     spec = TabHost.NewTabSpec(tag); 
     var drawableIcon = Resources.GetDrawable(drawableId); 
     spec.SetIndicator(label, drawableIcon); 
     spec.SetContent(intent); 

     TabHost.AddTab(spec); 
    } 

我使用上面的代碼來創建選項卡。

請幫忙, 謝謝。

回答

1

我得到它的工作,下面是代碼

TabWidget.GetChildAt(0).SetBackgroundColor(Color.PaleGreen); //1st tab 
相關問題