Layout:
<?xml version= "1.0" encoding= "Utf-8"? ><tabhost xmlns:android= "Http://schemas.android.com/apk/res/android " android:id=" @android: Id/tabhost " android:layout_width=" fill_parent " android:layout_height=" Fill_ Parent "> <linearlayout android:orientation=" vertical " android:layout_width=" Fill_parent " android:layout_height= "fill_parent" android:padding= "5DP" > <tabwidget android:id= "@ Android:id/tabs " android:layout_width=" fill_parent " android:layout_height=" wrap_content "/> <framelayout android:id= "@android: id/tabcontent" android:layout_width= "Fill_parent" android: layout_height= "Fill_parent" android:padding= "5DP"/> </LinearLayout></TabHost>
Activity (to inherit from tabactivity):
To create a Createtab method
private void Createtab (Type activitytype, string tag, string label, int drawableid) { var intent = new Intent (this , activitytype); Intent. Addflags (activityflags.newtask); var spec = Tabhost.newtabspec (tag); var Drawableicon = resources.getdrawable (Drawableid); Spec. Setindicator (label, Drawableicon); Spec. SetContent (intent); Tabhost.addtab (spec); }
Create a two tab
Createtab (typeof (Businesssearch), "Search", "search", Resource.Drawable.abc_ab_share_pack_mtrl_alpha); Createtab (typeof (Myorders), "My Orders", "My Orders", Resource.Drawable.abc_btn_check_material);
C # + Xamarin to develop Android apps---tab implementation