zoukankan      html  css  js  c++  java
  • titanium开发教程0302自定义tab group

    12

    app.js

    Titanium.UI.setBackgroundColor("#000");
    
    var tabGroup = Titanium.UI.createTabGroup();
    
    var toursWindow = Titanium.UI.createWindow({  
        title:"Tours",
        backgroundColor:"#FFFFFF",
        //因为 window 是封装在tab里, 它自动拥有一个 nav bar
        // navbar 仅在 iOS里有样式
        barColor:"#32411b" 
    });
    
    var image = Titanium.UI.createImageView({
    	image:"images/exploreCalifornia.png",
    	96,
    	height:119,
    });
    
    var caption = Titanium.UI.createLabel({
    	text:"Open the Specials Tab (Tap Here)",
    	bottom:20,
    	height:"auto",
    	"auto",
    	textAlign:"center",
    	color:"#000000"
    });
    
    toursWindow.add(image);
    toursWindow.add(caption);
    
    var toursTab = Titanium.UI.createTab({  
        icon:"tours-tab.png",
        title:"Tours",
        window:toursWindow	
    });
    
    var specialsWindow = Titanium.UI.createWindow({  
        title:"Specials",
        backgroundColor:"#FFFFFF",
        url:"specials.js"	
    });
    var specialsTab = Titanium.UI.createTab({  
        icon:"specials-tab.png",
        title:"Specials",
        window:specialsWindow
    });
    
    caption.addEventListener("click", function(e){
    	tabGroup.setActiveTab(1);
    });
    
    tabGroup.addTab(toursTab);  
    tabGroup.addTab(specialsTab);
    
    tabGroup.open();

    specials.js

    var win = Titanium.UI.currentWindow;
    win.barColor = "#efe269";
    
    var label = Titanium.UI.createLabel({
    	text:"Specials of the Day",
    	"auto",
    	height:"auto",
    	bottom:20,
    	textAlign:"center"
    });
    
    win.add(label);
    //这不需要呼叫win.open() 当从 window打开tab 
  • 相关阅读:
    Python 数据驱动 unittest + ddt
    接口知识介绍
    python 爬虫
    python 接口测试(三)
    基于PCA和SVM的人脸识别系统-error修改
    二分查找算法
    JAVA中运用数组的四种排序方法
    [Matlab] Attempt to execute SCRIPT *** as a function
    第36讲 activityForResult
    第35讲 Activity入门和跳转
  • 原文地址:https://www.cnblogs.com/xiaozhanga4/p/2403080.html
Copyright © 2011-2022 走看看