xamarin.android tab,C# + Xamarin开发Android应用 --- Tab的实现

Layout:<?xml version="1.0" encoding="utf-8"?>

android:id="@android:id/tabhost"

android:layout_width="fill_parent"

android:layout_height="fill_parent">

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:padding="5dp">

android:id="@android:id/tabs"

android:layout_width="fill_parent"

android:layout_height="wrap_content" />

android:id="@android:id/tabcontent"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:padding="5dp" />

Activity (要从TabActivity继承):

创建CreateTab方法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);

}

创建两个TabCreateTab(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开发Android应用 --- Tab的实现的内容,更多相关内容请关注PHP中文网(www.php.cn)!

声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值