位置: 编程技术 - 正文

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局部界面切换)

  • 企业名称税号
  • 捐赠支出纳税调减
  • 个人给单位做事怎么开发票
  • 什么类型的电子商务
  • 未开票收入缴纳增值税怎么冲减补开发票
  • 公司个人借款如何入账
  • 失业保险费返还后是给单位还是给员工
  • 物业费免交条件
  • 复式记账的优点有哪些
  • 辅导期一般纳税人什么意思
  • 结转以前的其他业务成本如何做会计分录呢?
  • 以旧换新如何确认收入
  • 自产的产品无偿赠送职工
  • 出口退税当期不得免征和抵扣的税额
  • 股票投资及收益计算公式
  • 商业银行固定资产贷款
  • 专票打印的时候密码区压线了能用吗
  • 个税个人所得税返回
  • 个人所得税费怎么计算2021
  • 工程会计做账流程及会计分录
  • 涉农和中小企业贷款分类证明没有就不能进行税前扣除么
  • 电子汇票如何使用
  • 小规模普通发票可以抵扣吗
  • 酒类应税消费品消费税纳税申报表怎么填
  • win 7怎么办
  • guest的作用
  • 无法访问windows installer服务,没有正确安装
  • 罚款是否需要开发票
  • 年终结算增值税怎么算
  • file*fp什么意思
  • 寿命最短的苹果手机
  • 职工医保报销会扣医保卡的钱吗
  • 会计差错及账项调整
  • 青龙面板搭建教程
  • oss使用场景
  • redis主从复制如何保证不丢失数据
  • 矿产资源补偿费是什么
  • python数学建模资料
  • 企业会计准则规定了
  • 残疾人就业保障金减免政策2023
  • 银行日记账更正
  • phpcms插件
  • 收到抵扣发票怎么做分录
  • mysql复制表语句
  • 支付劳务费会计科目怎么写
  • 高速费会计分录怎么写
  • 旅游业差额开票税率
  • 出售固定资产的损失计入什么科目
  • 商业折扣影响主营业务成本吗
  • 回购股票不注销如何发可转债
  • 土地增值税是什么税种类型
  • 企业找审计是为了什么
  • 进出口贸易公司取名字大全
  • 公司注销怎么做
  • 暂估入库成本差异
  • 存货账面价值入哪个科目
  • 当月发票未作废
  • 存货核算的含义
  • mac安装surge
  • win10预览版21277下载
  • ami 2.17.1254bios设置图解教程
  • macbookair自带系统
  • mac如何修改hosts登录Googledrive
  • 如何进入win10安装界面
  • PHP 7.0.0 Alpha 2 发布
  • cocos2dx在暂停某些元素后导致crash问题
  • a*算法的优缺点
  • nginx日志按天切割
  • xbox无法连接无线网络
  • windows安装python pip
  • 基于nodejs的框架
  • jquery的使用
  • 关于挂职的规定
  • 北京12366纳税服务平台
  • 郑州市华润燃气多少钱一立方
  • 浙江省发票勾选认证操作流程2021
  • 广州车船税每年交多少
  • 停车票日期在哪里
  • 汽车商业险退保还有手续费吗
  • 1973年简并税制
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设