sencha touch 模仿tabpanel导航栏TabBar(2013-11-7)
基于sencha touch 2.2所写
代码:
- /*
- *模仿tabpanel导航栏
- */
- Ext.define('ux.TabBar', {
- alternateClassName: 'tabBar',
- extend: 'Ext.Toolbar',
- xtype: 'tabBar',
- config: {
- docked: 'bottom',
- cls: 'navToolbar',
- layout: {
- align: 'stretch'
- },
- defaults: {
- flex: 1
- },
- //被选中的按钮
- selectButton: null
- },
- initialize: function () {
- var me = this;
- me.callParent();
- //监听按钮点击事件
- me.on({
- delegate: '> button',
- scope: me,
- tap: 'onButtonTap'
- });
- },
- //更新被选中按钮
- updateSelectButton: function (newItem, oldItem) {
- if (oldItem) {
- oldItem.removeCls('x-tabBar-pressing');
- }
- if (newItem) {
- newItem.addCls('x-tabBar-pressing');
- }
- },
- //当按钮被点击时
- onButtonTap: function (button) {
- if (!button.getInitialConfig('noSelect')) {
- this.setSelectButton(button);
- }
- },
- /**
- * @private
- *执行添加项,调用add方法后自动执行
- */
- onItemAdd: function (item, index) {
- if (!this.getSelectButton() && item.getInitialConfig('selected')) {
- this.setSelectButton(item);
- }
- this.callParent(arguments);
- }
- });
需要的css:
- .navToolbar {
- padding:;
- }
- .navToolbar .x-button {
- border:;
- margin:;
- border-right:1px solid #585B5B;
- border-radius:;
- padding:;
- }
- .navToolbar .x-button .x-button-label {
- font-weight:normal;
- color:White;
- font-size:0.6em;
- }
- .navToolbar .x-tabBar-pressing {
- background-image:none;
- background-color:#0f517e;
- background-image:-webkit-gradient(linear,50% 0%,50% 100%,color-stop(0%,#0a3351),color-stop(10%,#0c4267),color-stop(65%,#0f517e),color-stop(100%,#0f5280));
- background-image:-webkit-linear-gradient(top,#0a3351,#0c4267 10%,#0f517e 65%,#0f5280);
- background-image:-moz-linear-gradient(top,#0a3351,#0c4267 10%,#0f517e 65%,#0f5280);
- background-image:-o-linear-gradient(top,#0a3351,#0c4267 10%,#0f517e 65%,#0f5280);
- background-image:linear-gradient(top,#0a3351,#0c4267 10%,#0f517e 65%,#0f5280);
- }
使用:
- Ext.define('app.view.MyBar', {
- alternateClassName: 'myBar',
- extend: 'ux.TabBar',
- xtype: 'myBar',
- requires: ['app.view.About'],
- config: {
- items: [
- {
- xtype: 'button',
- text: '首页',
- //只有第一个设置的属性有效
- selected: true,
- action: 'redirect',
- redirect: 'home'
- },
- {
- xtype: 'button',
- text: '关于',
- action: 'redirect',
- redirect: 'about'
- },
- {
- xtype: 'button',
- text: '其他',
- //没有选中效果
- noSelect:true,
- action: 'other'
- }]
- }
- });
效果图:
2013.11.7
增加配置:没有选中效果
使用示例:
http://www.cnblogs.com/mlzs/p/3382229.html
sencha touch 模仿tabpanel导航栏TabBar(2013-11-7)的更多相关文章
- sencha touch 模仿tabpanel导航栏TabBar的实现代码
这篇文章介绍了sencha touch 模仿tabpanel导航栏TabBar的实例代码,有需要的朋友可以参考一下 基于sencha touch 2.2所写 效果图: 代码: /* *模仿tabpan ...
- sencha touch 2 tabpanel中List的不显示问题,解决方案
笔者在做sencha项目的时候碰到一个需求,就是"好友列表"中分为"未确认好友"和"已确认好友",两个都是一个list,自然想到的就是使用t ...
- 小程序 - 底部导航栏“tabBar”
小程序底部导航 1.app.json页面配置: { "pages": [ "pages/movie/movie", "pages/cinema/cin ...
- 添加底部导航栏tabbar
效果图: 如果要添加底部导航栏,最少2个,最多5个. app.json { "pages": [ "pages/index/index", "page ...
- 01 uni-app框架学习:项目创建及底部导航栏tabBar配置
1.创建一个项目类型选择uniapp 2. pages里新建3个页面如下 3.在pages.json中配置底部导航tabBar 效果展示:
- 第一步 使用sencha touch cmd 4.0 创建项目、打包(加入全局变量、公用类、自定义扩展、资源文件)
参考资料: http://www.cnblogs.com/qqloving/archive/2013/04/25/3043606.html http://www.admin10000.com/docu ...
- 微信小程序------导航栏样式、tabBar导航栏
一:导航栏样式设置 小程序的导航栏样式在app.json中定义. 这里设置导航,背景黑色,文字白色,文字内容测试小程序 app.json内容: { "pages":[ " ...
- 微信小程序入门四: 导航栏样式、tabBar导航栏
实例内容 导航栏样式设置 tabBar导航栏 实例一:导航栏样式设置 小程序的导航栏样式在app.json中定义. 这里设置导航,背景黑色,文字白色,文字内容测试小程序 app.json内容: { & ...
- Taro多端自定义导航栏Navbar+Tabbar实例
运用Taro实现多端导航栏/tabbar实例 (H5 + 小程序 + React Native) 最近一直在捣鼓taro开发,虽说官网介绍支持编译到多端,但是网上大多数实例都是H5.小程序,很少有支持 ...
随机推荐
- Python:查看矩阵大小,查看列表大小
对于Python3.5 查看矩阵大小 >>>import numpy as np >>>from numpy import random >>>m ...
- UNIX环境编程学习笔记(9)——文件I/O之文件访问权限的屏蔽和更改
lienhua342014-09-10 1 文件访问权限 在文件访问权限和进程访问控制中,我们已经讲述过文件访问权限位,为了方便,我们重新列在下面, 表 1: 文件的 9 个访问权限位 st_mod ...
- Capability Model
Data Scientist, Analytics We’re looking for data scientists to work on our core and business product ...
- Kafka配置说明
Broker Configs Property Default Description broker.id 每个broker都可以用一个唯一的非负整数id进行标识:这个id可以作为broker的 ...
- 图像中的artifacts
artifacts 瑕疵 伪影(Artifacts) 伪影(Artifacts)-CT-基础术语 - 影像园 http://www.xctmr.com/baike/ct/c34b5413e305b45 ...
- MLE、MAP、贝叶斯三种估计框架
三个不同的估计框架. MLE最大似然估计:根据训练数据,选取最优模型,预测.观测值D,training data:先验为P(θ). MAP最大后验估计:后验概率. Bayesian贝叶斯估计:综合模型 ...
- ab压测札记(Apache Bench)
1 ab安装 ab实际上是apache httpd里面的一个工具或者说子模块,安装apache httpd可以参考另一篇文章JBOSS集群的2.3节 安装目录:/apache目录/bin/,如下 2 ...
- 7 -- Spring的基本用法 -- 12... Spring 3.0 提供的表达式语言(SpEL)
7.12 Spring 3.0 提供的表达式语言(SpEL) Spring表达式语言(简称SpEL)是一种与JSP 2 的EL功能类似的表达式语言,它可以在运行时查询和操作对象图.支持方法调用和基本字 ...
- video标签 api
video 设置及控制:http://www.w3school.com.cn/tags/html_ref_audio_video_dom.asp video 事件:http://www.w3schoo ...
- 【RF库Collections测试】Remove Duplicates
Name:Remove DuplicatesSource:Collections <test library>Arguments:[ list_ ]Returns a list witho ...