zoukankan      html  css  js  c++  java
  • titanium开发教程0210创建的文本字段与嵌入的按钮

    1该功能无法再android使用,只能在ios上正常显示

    var win = Titanium.UI.createWindow({
    	title:"Configuring text field and text area keyboard types",
    	backgroundColor:"#FFF",
    	exitOnClose:true
    });
    
    //These buttons will appear within the text field
    var clearButton = Titanium.UI.createButton({
    	title:"Clear",
    	height:24,
    	52
    });
    
    var submitButton = Titanium.UI.createButton({
    	title:"Submit",
    	height:24,
    	60
    });
    
    var textField = Titanium.UI.createTextField({
    	top:"25%",
    	height:35,
    	300,
    	borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
    	hintText:"Type something",
    	keyboardType:Titanium.UI.KEYBOARD_DEFAULT,
    	leftButton:clearButton,
    	rightButton:submitButton
    });
    
    clearButton.addEventListener("click", function(e){
    	//Clear the value of the text field
    	textField.value = "";
    });
    
    submitButton.addEventListener("click", function(e){
    	//Pretend to submit the value of the text field
    	//Be sure that you've typed something in!
    	if(textField.value != ""){
    		alert(textField.value);	
    	}else{
    		alert("Enter some text");
    	}
    });
    
    //Add an event listener to the window that allows for the keyboard or input keys to be hidden if the user taps outside a text field
    //Note: each text field to be blurred would be added below
    win.addEventListener("click", function(e){
    	textField.blur(); // Cause the text field to lose focus, thereby hiding the keyboard (if visible)
    });
    
    win.add(textField);
    
    win.open();
  • 相关阅读:
    DockerFile 解析
    Docker 容器数据卷
    Docker 镜像
    Docker 常用命令
    Docker 安装
    vue全站式笔记
    接口环境配置
    前端跨域的三种方式
    vue+axios 模拟后台返回数据的三种方式:本地创建json、easymock平台、mockjs
    cookie、sessionStorage与localStorage是什么?
  • 原文地址:https://www.cnblogs.com/xiaozhanga4/p/2402813.html
Copyright © 2011-2022 走看看