位置: 编程技术 - 正文

android TabHost小结(android navigation bar)

编辑:rootadmin

推荐整理分享android TabHost小结(android navigation bar),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:安卓 localhost,android filehost,android.support.design.widget.tablayout,android filehost,androidhomepage,安卓 localhost,安卓 localhost,android.support.design.widget.tablayout,内容如对您有帮助,希望把文章链接给更多的朋友!

转载:

TabHost是整个Tab的容器,包括两部分,TabWidget和FrameLayout。TabWidget就是每个tab的标签,FrameLayout则是tab内容。

android TabHost小结(android navigation bar)

1、如果我们使用extends TabAcitivty,如同ListActivity,TabHost必须设置为@android:id/tabhost 2、TabWidget必须设置android:id为@android:id/tabs 3、FrameLayout需要设置android:id为@android:id/tabcontent 4、参考这儿:<a href=" http:="" www.2cto.com="" kf="" web="" asp="" "="" target="_blank" class="keylink" style="color: rgb(, , ); text-decoration: none;">aspx"> Java代码 <?xml version="1.0" encoding="utf-8"?> <TabHost xmlns: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"> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1.0" android:paddingBottom="px"/> <TabWidget android:id="@android:id/tabs" android:layout_alignParentBottom="true" android:layout_width="fill_parent" android:layout_height="px" android:visibility="gone" android:layout_weight="0.0"/> <RadioGroup android:gravity="center_vertical" android:orientation="horizontal" android:id="@&#;id/main_radio" android:background="@drawable/radiogroup_background" android:layout_width="fill_parent" android:layout_height="dip" android:layout_gravity="bottom"> <RadioButton android:id="@&#;id/main_index_button" android:layout_marginTop="1.0dip" android:layout_marginRight="5dip" android:text="@string/main_name" android:drawableTop="@drawable/unistall" style="@style/main_tab_bottom" android:background="@drawable/radio_bg"/> <RadioButton android:id="@&#;id/main_running_button" android:layout_marginTop="1.0dip" android:layout_marginRight="5dip" android:text="@string/run_manager_name" android:drawableTop="@drawable/unistall" style="@style/main_tab_bottom" android:background="@drawable/radio_bg"/> <RadioButton android:id="@&#;id/main_uninstall_button" android:layout_marginTop="1.0dip" android:text="@string/uninstall_manager_name" android:drawableTop="@drawable/unistall" style="@style/main_tab_bottom" android:background="@drawable/radio_bg"/> </RadioGroup> </LinearLayout> </TabHost>

为了让tabHost显示在下方,要将RadioGroup的layout_gravity设置为bottom,再将FrameLayout的layout_weight设置为1,这样就可以将RadioGroup撑到最下方。style="@style/main_tab_bottom"里面定义了样式文件。

接下来就是在activity中初始化并添加tabhost: Java代码 tabHost = (TabHost) findViewById(android.R.id.tabhost); tabHost.addTab(Constant.tabHost.newTabSpec("Main") .setIndicator(getString(R.string.main_name),null) .setContent(new Intent(this, Main.class))); tabHost.addTab(Constant.tabHost.newTabSpec("RunManager") .setIndicator(getString(R.string.run_manager_name),null) .setContent(new Intent(this, RunManager.class))); tabHost.addTab(Constant.tabHost.newTabSpec("UninstallManager") .setIndicator(getString(R.string.uninstall_manager_name),null) .setContent(new Intent(this, UninstallManager.class)));

初始化每个RadioButton并为其添加setOnCheck

android 判断切换后台 判断按下home键 写这个博客不是为了实现监听home键,而是判断切换后台,说过不写一些没意思的博客,监听home键或者屏蔽home键的方法,请百度。我这个篇博客只是想

Android—如何查看android源码 我是根据以下文章来查看声明:高手跳过此文章当我们在eclipse中开发android程序的时候,往往需要看源代码(可能是出于好奇,可能是读源码习惯),那

Android广告轮播图效果实现 效果如下:首先看下一下布局文件:RelativeLayoutxmlns:android="

标签: android navigation bar

本文链接地址:https://www.jiuchutong.com/biancheng/385947.html 转载请保留说明!

上一篇:android自定义属性三部曲(android 自定义style)

下一篇:android 判断切换后台 判断按下home键(android局部界面切换)

  • 旅客运输服务解释
  • 固定资产清理的账务处理
  • 提取法定盈余公积是从净利润中提取吗
  • 超市的库存商品分类混乱怎么看出来的
  • 电汇汇票和电汇的异同点
  • 增值税专用发票抵扣期限
  • 与企业日常无关的政府补服属于利得吗
  • 减免企业所得税怎么算
  • 小规模纳税人报税前需要做什么
  • 税控设备发行是什么行业
  • 研发费用 会计核算
  • 公司租车要交什么费用
  • 运输公司租赁车辆开几个点的发票
  • 以前年度管理费用多计
  • 什么是差额增收
  • 购买固定资产没付款怎么入账
  • 新注册的公司什么时候可以开票纳税
  • 土地增值税纳税地点
  • 一般纳税人施工费税率是多少
  • 业主委员会的收益
  • 土地出让金为何写有效期
  • 固定资产计提折旧的会计科目
  • 升级设备属于什么科目
  • 银行存款二级科目怎么增加
  • 福利费专票进项抵扣转出怎么做账
  • 企业已确认销售收入的售出商品发生销售折让,且不属于
  • VM虚拟机怎么安装网心容器
  • mac u盘
  • 电脑的c盘变红怎么回事
  • php 替换
  • PHP:pg_transaction_status()的用法_PostgreSQL函数
  • NJeeves.exe - NJeeves进程文件是什么意思 有什么用
  • 总分机构分摊比例如何确定
  • 资产现金流量收益率计算方法
  • 前端html模板
  • 前端不使用明文密码方案
  • mapbox怎么用
  • 关于高德地图的分析报告
  • python单链表的创建
  • 企业所得税年报滞纳金从哪天开始算
  • 现金流量表上期金额
  • 进出口企业需要英文公章吗
  • 为什么出台农产品质量安全法
  • 个人独资企业计提的各种准备金支出不得扣除
  • 员工自己全额承担社保费用要计提吗
  • 工会经费计税依据是应发还是实发
  • 小规模纳税人无票收入申报表怎么填
  • 增值税进项税转出有哪些
  • 如何提取十位数
  • 土地承包经营合同生效条件
  • 企业用支付宝
  • 委托加工产品消费税税率
  • 网银转账被退回来了
  • 核销报验登记流程
  • 委托付款做账怎么做
  • 补贴计税吗
  • 收到票据之后贴什么标签
  • 如何建立明细分类账
  • windows8休眠如何唤醒
  • 如何编译安装
  • 电脑硬件用途
  • 怎么操作win10系统
  • linux学习思路
  • macbookair2015安装win7 单系统
  • unity shader
  • opengl 投影矩阵
  • bat批处理命令大全
  • Python 中urls.py:URL dispatcher(路由配置文件)详解
  • javascript中的107个基础知识收集整理 推荐
  • android ui开发
  • javascript基础
  • python一些简单操作
  • 使用灭火器时要对准火焰的什么部位喷射
  • 百望税控盘电子发票怎么打
  • 税务文书有哪些
  • 税务局查帐流程
  • 火灾损失进项税额怎么处理
  • 印刷行业费用标准
  • 税控盘口令密码怎么修改
  • 白酒消费税应纳税额
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设