Take a look at this Module: https://github.com/viezel/NappUI
これは、SearchBarを含むいくつかのUI要素のプロパティを拡張したもので、ここではリストです。
- SearchField BackgroundImage
- Custom Cancel button
- barColor - background gradient of the button. (similar to navbar)
- color - color of the button title
- title - change the default Cancel text
- font - set the font of the button
- Appearance of the keyboard
- Disable the search icon
インストールするには、新しい gitTio コマンドラインを使用することをお勧めします。これは自動的にモジュールをダウンロードし、モジュールにインストールしますフォルダを開き、tiapp.xmlに適切な設定行を追加します。
gittio install -g dk.napp.ui
次に、このモジュールで有効になっている新しいプロパティを使用したSearchBarの例を示します
var searchBar = Ti.UI.createSearchBar({
searchFieldBackgroundImage:"searchbg.png",
showsScopeBar:true,
scopeButtonTitles:["hello", "yes"],
customCancel:{
barColor:"#333",
color:"#ddd",
title:"Hit me",
font:{
fontSize:16,
fontWeight:"bold",
fontFamily:"Georgia"
}
},
appearance:Titanium.UI.KEYBOARD_APPEARANCE_ALERT,
barColor:"transparent",
disableSearchIcon:true //disables the search icon in the left side
});