T语言与快速开发平台之天宇联Android开发手册

来源:互联网 发布:程序员年龄大了没出路 编辑:程序博客网 时间:2024/04/29 16:20

天宇联Android开发手册

ttyu.common通用类

 

方法

说明

GetFunctionValue(stringdataMember)

获取方法的值

RunFunctions(stringformula)

获取表达式的值

GetKeyValue(thisstring str,string key)

获取url的键值

 

 

控制包ttyu.controller

1.     通用类Command

方法

说明

GetFunctionValue(StringdataMember)

获取方法的值

RunFunctions(Stringformula)

获取表达式的值

GetKeyValue(thisString str,String key)

获取url的键值

 

 

2.     字符串处理类String.

方法

说明

GetBefore(thisString str, String subStr)

得到字符串中子字符串的前部分

GetBeforeLast (thisString str, String subStr)

得到字符串中最后子字符串的前部分

GetAfter(thisString str, String subStr)

得到字符串中子字符串的后部分

GetAfterLast(thisString str, String subStr)

得到字符串中最后子字符串的后部分

GetBetween(this String str, String StartText, String EndText)

得到字符串的中间部分的字符串

IsNullOrEmpty(String str )

判断是否为空串或null

contains(String str, String subStr)

不区分大小写,一个字符串是否包含另一个字符串

 

 

 

3.     服务类 Server. 调用远程接口,返回数据

方法

说明

DoServiceByUrl (String url)

调用服务接口url,返回JSON对象

DoService (String action, Stringpara)

执行action动作,返回JSON对象

isNetworkAvailable(Context context)

判断是否有网络

 

 

isMobileDataEnable(Context context)

判断MOBILE网络是否可用

isWifiDataEnable(Context context)

判断wifi 是否可用

setBigData(HttpURLConnection conn ,String bigStr)

 

getBigJSONArray(String action,String bigData)

获得大的json数组

toJSONArray(String bigData)

把大数据转化为json数组

getBigJSONObject(String action,String bigData)

获取大的JsonObject数据

getBigString(String action,String bigData)

执行action动作

getStringByUrlConnection(String strUrl)

通过url获取字符串

GetImageUrl(String pic)

根据图片名获取图片地址

getDataByUrl(String paras)

通过参数paras获取字符串数据

getDataByUrl(String action,String paras)

通过动作action和参数paras获得字符串数据

getJsonDatas(String action,String paras)

通过动作action和参数paras获得jsonArray数据                    

getJsonDatas(String paras)

通过参数paras获得jsonArray数据

getJsonData(String action,String paras)

通过动作action和参数paras获得jsonObject数据

getData(String action,String paras)

通过动作action和参数paras获得字符串数据

 

4.     用户类User. 当前用户信息

方法

说明

isLogin ()

是否登录

saveUser(String userInfo)

保存用户信息

getUserInfo()

获取用户信息

getUser()

获取用户

getUserId()

获取登录人的id

getUserName()

获取登录人的姓名

getUserImage()

获取登录人的照片

getDeptId()

获取登录人的部门id

getDeptName()

获取登录人的部门名称

getUserType()

获取登录人的用户类型

getUserToken()

获取登录人的令牌

getMenu()

获取登录人的菜单权限

 

5.     验证类Validate. 数据格式验证

方法

说明

IsMail

邮箱地址

IsChina

只允许中文字符

IsTel

国内电话号码

NoNull

不能为空

NoEqual

不等于

NoCan

不能

IsModulCode

国内手机号码11位数字码

IsIP

IP地址,如: 192.168.1.100

IsInt

Int型,如: 45 或 888

IsNumber

数字型,非字符,如: 111 或 -094

IsLengthStr

字符串的长度是不是在限定数之间

IsPostCode

邮政编码 6个数字,如: 100000 或 437100

IsNormalChar

正常字符字母,数字,下划线的组合,但不包括如【~ @ ! $ # % ...】等,如: abyu 或 13946662511

IsQq0

匹配腾讯QQ号,如: 39062477 或 4500983

IsAlphanumber

只有字母或数字或_,如: a131466_62511 或 1394666251

IsOnly

数据唯一,不能重复

LenMax

数据长度不能超过len位

LenMin

数据长度不能少于len位

Len

数据长度只能是len位

Number

数据长度只能是len位的数字类型

NumberBetween

一定范围内的数字类型

 

 

 

6.     块/视图类Block

 

type(类型)

方法

视图类型说明

 

init (this,paras)

页面初使化

tab

LoadTab (this, String[]items)

LoadTab(this, Stringtab1, String[]items);

选项卡/标签页

carouse

LoadCarouse (this, Stringcarouse1)

轮播图(本地图片)/图片关联数据库

header

LoadHeader (this, String[]items),

LoadHeader (this, Stringheader, String[]items)

头部

table

LoadTable(this, Stringtable, String[]items)

表格/列表

menu

LoadMenu(this,items)

LoadMenu(this,menu1,items)

功能菜单列表/网络

form

LoadForm(this,form1,rows)

表单

buttons

 

按纽组

dialog

 

对话框

Spinner

 

下拉列表

 

 

 

7.     App方法类

show(String msg)

Tosat提示封装方法msg为想提示的信息

show()

显示dialog的方法

LoadImage(ImageView view,String file,Context me)

加载本地图片资源到控件

GetBitmap(String sUrl)

通过Url获取bitma

Drawable2Bitmap(Drawable drawable)

把Drawable变为bitmap

GetDrawableByUrl(String sUrl)

通过Url获取Drawable

GetDrawable(String imageName)

通过图片名获取Drawable

GetDrawable(Context me,String name)

 

ToDrawable(Bitmap bmp)

Bitmap转为Drawable

GetDrawableByAssets(Context me,String fileName)

获取Assets资产文件下的图片通过文件名返回的是Drawable类型的

GetBitmapByAssets(Context me,String fileName)

获取Assets资产文件下的图片通过文件名返回的是

Bitmap类型的

GetInputStreamByAssets(Context me,String fileName)

获取Assets目录下的文件流

getByRaw(Context me,String fileName)

获取Raw返回的是字符串

GetStringByAssets(String fileName)

获取assets资产下的文件返回的是字符串

GetResourceID(Resources res,String name,String type,String packageName)

 

GetResourceID(Context me,String name,String type,String packageName)

 

GetScreenWidth(Context context)

获取屏幕的宽

getScreenHeight(Context context)

获取屏幕的高

SetData(String key,String value)

保存数据到SharedPreferences

GetData(String key)

获取SharedPreferences中的数据

InputStream2Bytes(InputStream in)

将输入流变为一个byte数组

GetString(JSONObject oJson,String name)

通过键名name获取oJson对象中的数据

以String的形式返回

GetInt(JSONObject mAttrs,String name)

通过键名name获取oJson对象中的数据

以int的形式返回

GetFloat(JSONObject oJson,String name)

通过键名name获取oJson对象中的数据

以float的形式返回

GetBool(JSONObject oJson,String name)

通过键名name获取oJson对象中的数据

以float的形式返回

View2JSONObject(View view)

获取view上的信息以JSONObject的形式返回

GetBool(JSONObject oJson,String name)

通过键名name获取oJson对象中的数据

以boolean的形式返回

 

模型/实体包ttyu.model

1.     页面初使化Init

 

属性

数据类型

说明

backColor

String

背景色

backImage

String

背景图片

full

boolean

是否全屏

move

String

 

动画效果;0:从左向右,R.anim.move_in_left, R.anim.move_out_left 1: 从右向左,2: 从上向下,3:从下向上,4:放大缩小R.anim.zoomin, R.anim.zoomout 5:淡入淡出R.anim.alphain, R.anim.alphaout

fromXScale

float

X缩放scale 

toXScale

float

动画效果

fromYScale

float

动画效果

toYScale

float

动画效果

duration

float

时长(秒)

pivotX

float

动画效果alpha 

pivotY

float

动画效果

fromAlpha

float

动画效果

toAlpha

float

动画效果

duration

float

动画效果

 

2.     选项卡/标签Tab

 

属性

数据类型

说明

type

String

选项卡类型.normal/0:普通, upImage/1:上边图标, leftImage/2:左边图标,rightImage/3:右边图标, downImage/4:底边图标, line:竖直分割线

id

String

唯一id

width

int

height

int

left

int

偏移左宽.

top

int

偏移顶部高.

backColor

String

背景色

backImage

String

背景图片

radius

int

边框圆角度数

items

List<Field>

元素集合

 

 

 

 

3.     轮播图Carouse

 

属性

数据类型

说明

type

String

轮播图类型.local/0:本地图片,table/1:表中图片

id

String

唯一id

width

int

height

int

left

int

偏移左宽.

top

int

偏移顶部高.

radius

int

边框圆角度数

keys

String

数据库接口参数

 

 

 

 

4.     头部Header

 

属性

数据类型

说明

id

String

唯一id

width

int

height

int

高,默认50

backColor

String

背景色

backImage

String

背景图片

items

List<Field>

元素集合

radius

int

边框圆角度数

 

 

 

 

5.     表格/列表Table

 

属性

数据类型

说明

type

String

表格类型.normal/0:普通, upImage/1:上边图标, leftImage/2:左边图标,rightImage/3:右边图标, downImage/4:底边图标group/5:分组

groupField

String

分组字段.

id

String

唯一id

width

int

top

int

偏移顶部高.

rowHeight

int

行高

line

int

水平线高. 默认为1.

lineType

int

水平线类型, none/0:没有线条,real/1:1个单位的实线,dot/2:点线

backColor

String

背景色

backImage

String

背景图片

searchType

int

0:不带搜索,1:左图标的搜索,2: 中间图标的搜索, 3:右图标的搜索,4::不带图标的搜索

keys

String

数据库接口参数

radius

int

边框圆角度数

items

List<Field>

元素集合

6.     功能菜单列表/网络Menu

 

属性

数据类型

说明

type

String

表格类型. grid2 /2:2列网络,grid3 /3:3列网络,grid4 /4:4列网络, upImage/5:上边图标, leftImage/6:左边图标,rightImage/7:右边图标, downImage/8:底边图标, rand:随机排列, row:行排列, group/5:分组

id

String

唯一id

width

int

height

int

高,默认50

line

int

线高. 默认为1.

lineType

int

水平线类型, none/0:没有线条,real/1:1个单位的实线,dot/2:点线

backColor

String

背景色

backImage

String

背景图片

items

List<Field>

元素集合

radius

int

边框圆角度数

 

 

 

 

7.     可编辑表单Form

 

属性

数据类型

说明

type

String

表单类型.edit/0:可编辑,editGroup/1:分组可编辑,show/2:行显示, showGroup/3:分组行显示,showLine:线性显示, ,showItem:显示明细

id

String

唯一id

width

int

height

int

高,默认50

top

int

偏移顶部高.

line

int

水平线高. 默认为1.

lineType

int

水平线类型, none/0:没有线条,real/1:1个单位的实线,dot/2:点线

backColor

String

背景色

backImage

String

背景图片

table

String

数据库表

items

List<Field>

元素集合

radius

int

边框圆角度数

8.     按钮组Buttons

 

属性

数据类型

说明

type

String

按钮类型.one/1:单个,editGroup/1:分组可编辑,show/2:行显示, showGroup/3:分组行显示,showLine:线性显示, ,showItem:显示明细

id

String

唯一id

width

int

height

int

高,默认50

top

int

偏移顶部高.

backColor

String

背景色

backImage

String

背景图片

items

List<Field>

元素集合

radius

int

边框圆角度数

9.     对话框Dialog

 

属性

数据类型

说明

type

String

按钮类型.one/1:单个,editGroup/1:分组可编辑,show/2:行显示, showGroup/3:分组行显示,showLine:线性显示, ,showItem:显示明细

id

String

唯一id

width

int

height

int

高,默认50

top

int

偏移顶部高.

backColor

String

背景色

backImage

String

背景图片

 

 

 

 

10. 下拉列表Spinner

 

属性

数据类型

说明

type

String

按钮类型.one/1:单个,editGroup/1:分组可编辑,show/2:行显示, showGroup/3:分组行显示,showLine:线性显示, ,showItem:显示明细

id

String

唯一id

width

int

height

int

高,默认50

top

int

偏移顶部高.

backColor

String

背景色

backImage

String

背景图片

radius

int

边框圆角度数

 

 

 

 

 

11. 字段/控件Field的属性

属性

数据类型

说明

type

String

控件类型

id

String

关键表的字段,唯一.如没关联,则按行号自动生成编号

text

String

显示文本

value

String

值,用于对话框中传值,

inputType

String

"text"--输入普通字符, "textCapCharacters"--输入普通字符, "textCapWords"--单词首字母大小, "textCapSentences"--仅第一个字母大小, "textAutoCorrect"--前两个自动完成, "textAutoComplete"--前两个自动完成, "textMultiLine"--多行输入, "textUri"--URI格式, "textEmailAddress"--电子邮件地址格式, "textEmailSubject"--邮件主题格式, "textShortMessage"--短消息格式, "textLongMessage"--长消息格式, "textPersonName"--人名格式, "textPostalAddress"--邮政格式, "textPassword"--密码格式,, "textVisiblePassword"--密码可见格式, textWebEditText"--作为网页表单的文本格式, "textFilter"--文本筛选格式, "textPhonetic"--拼音输入格式, "number"--数字格式,, "numberSigned"--有符号数字格式,, "numberDecimal"--可以带小数点的浮点格式,, "phone"--拨号键盘, "datetime","date"--日期键盘, "time"--时间键盘

width

int

height

int

color

String

颜色

background

String

背景色

colorLink

String

文字链接的颜色.

scaleX

float

设置文字之间间隔,默认为 1.0f。分别设置 0.5f/1.0f/1.5f/2.0f

shadowColor

String

指定文本阴影的颜色,需要与 shadowRadius 一起使用。

shadowRadius

float

设置阴影的半径。设置为 0.1 就变成字体的颜色了,一般设置为 3.0 的效果比较好

scaleType

String

设置图片的填充方式

src

String

设置图片文件

autoLink

String

 

设置是否当文本为 URL 链接/email/电话号码/map 时,文本显示为可点击的链接。可选值 (none/web/email/phone/map/all)

digits

String

设置允许输入哪些字符。如“1234567890.+-*/%\n()”

size

int

文字大小

style

String

设置字形[bold(粗体) 0, italic(斜体) 1, bolditalic(又粗又斜) 2] 可以设置一个或多个,用“|”隔开

typeface

String

文本字体,必须是以下常量值之一:normal 0, sans 1, serif 2, monospace(等宽字体) 3]

singleLine

boolean

单行显示后面用“…”来表示

 

 

 

 

字段/控件Field的类型(type)

 

type类型

控件

事件

控件说明

text

TextView

 

文本显示控件

editText

EditText

 

可编辑文本控件

button

Button

 

按钮控件

imageButton

ImageButton

 

图片按钮

image

ImageView

 

 

check

CheckBox

 

多项选择

radio

RadioButton

 

单选框控件

radioGroup

RadioGroup

 

单选框控件分组

 

AnalogClock

 

钟表(带表盘)

 

DigitalClock

 

电子表控件

 

DatePicker

 

日期选择控件

 

TimePicker

 

时间选择控件

 

ToggleButton

 

双状态按钮控件

 

Toast

 

提示

 

Spinner

 

下拉列表

 

 

 

 

 

 

 

 

 

 

服务/解析类Ttyu.helper

界面助手类Ttyu.helper.block

方法

说明

publicobject LoadBlock(String blockName,String[] items)

装载块

publicobjectCreateBlock(String blockName)

建立块

publicobject LoadHeader(String[] items)

 

publicobject LoadHeader(String[] items)

 

publicobject LoadHeader(String[] items)

 

public List<Field>CreateBlock (String[] items)

建立块内元素

publicTextViewCreateTextView (Field field)

建立文本显示控件

publicEditText CreateEditText (Field field)

建立可编辑文本控件

publicButton CreateButton (Field field)

建立按钮控件

publicImageButtonCreateImageButton (Field field)

建立图片按钮

publicImageViewCreateImageView (Field field)

建立图片

publicCheckBox CreateCheckBox (Field field)

建立多项选择控件

publicRadioButton CreateRadioButton (Field field)

建立单选框控件

publicRadioGroupCreateRadioGroup (Field field)

建立单选框控件分组

public AnalogClock CreateAnalogClock (Field field)

建立钟表(带表盘)控件

public DigitalClock CreateDigitalClock (Field field)

建立电子表控件控件

public DatePicker CreateDatePicker (Field field)

建立日期选择控件控件

public TimePicker CreateTimePicker (Field field)

建立时间选择控件控件

public ToggleButton CreateToggleButton (Field field)

建立双状态按钮控件

public Toast CreateToast (Field field)

建立提示控件

public Spinner CreateSpinner (Field field)

建立下拉列表控件

publicProgressBarCreateProgressBar (Field field)

建立(进度条控件

publicSeekBarCreateSeekBar (Field field)

建立可拖动的进度条控件

publicAutoCompleteTextViewCreateAutoCompleteTextView (Field field)

建立 AutoCompleteTextView自动完成的可编辑文本控件

publicMultiAutoCompleteTextView CreateMultiAutoCompleteTextView (Field field)

建立MultiAutoCompleteTextView输入多值控件

publicZoomControls Create ZoomControls (Field field)

ZoomControls - 放大/缩小按钮控件

publicInclude CreateInclude (Field field)

Include - 整合控件

publicVideoViewCreateVideoView  (Field field)

VideoView - 视频播放控件

publicWebView Create WebView (Field field)

WebView - 浏览器控件

publicRatingBar CreateRatingBar (Field field)

RatingBar - 评分控件

publicChronometer CreateChronometer(Field field)

Chronometer - 计时器控件

publicScrollView CreateScrollView (Field field)

ScrollView - 滚动条控件

publicTextSwitcher CreateTextSwitcher (Field field)

TextSwitcher - 文字转换器控件(改变文字时增加一些动画效果)

publicGallery CreateGallery (Field field)

Gallery - 缩略图浏览器控件

publicImageSwitcher CreateImageSwitcher  (Field field)

ImageSwitcher - 图片转换器控件(改变图片时增加一些动画效果)

publicGridView CreateGridView(Field field)

GridView - 网格控件

publicListView CreateListView (Field field)

ListView - 列表控件

publicExpandableList CreateExpandableList(Field field)

ExpandableList - 支持展开/收缩功能的列表控件

publicContextMenu CreateContextMenu(Field field)

ContextMenu-上下文菜单

publicDialogCreateDialog(Field field)

Dialog -对话框

 

 

 

 

 

 

 

 

 

 

模型包

块/视图ttyu.mode.block的类型(type)

type(类型)

视图类型说明

header

头部

carouse

轮播图(本地图片)/图片关联数据库

Tab

选项卡/标签页

menus

功能菜单

menus

功能菜单

menus

功能菜单

table

表格

buttons

按纽组

leftImageList

左图列表

rightImageList

右图列表

topImageList

顶图列表

 

 

editForm

编辑表单

showForm

显示表单

showItem

 

showRow

 

块/视图ttyu.mode.block的属性

属性

数据类型

说明

type

string

块/视图类型

id

string

唯一id

width

int

height

int

left

int

偏移左宽.

top

int

偏移顶部高.

backColor

string

背景色

backImage

string

背景图片

borderRadius

int

边框圆角度数

keys

 

数据库接口参数

 

 

 

 

字段/控件ttyu.mode.field的类型(type)

type类型

事件

控件说明

TextView

 

文本显示控件

EditText

 

可编辑文本控件

Button

 

按钮控件

ImageButton

 

图片按钮

ImageView

 

 

CheckBox

 

多项选择

RadioButton

 

单选框控件

RadioGroup

 

单选框控件分组

checkedButton

 

指定组内被选中的单选框的 ID

AnalogClock

 

钟表(带表盘)

DigitalClock

 

电子表控件

DatePicker

 

日期选择控件

TimePicker

 

时间选择控件

ToggleButton

 

双状态按钮控件

Toast

 

提示

Spinner

 

下拉列表

 

 

 

 

 

 

 

字段/控件ttyu.mode.field的属性

属性

数据类型

说明

type

string

控件类型

id

string

关键表的字段,唯一.如没关联,则按行号自动生成编号

text

string

显示文本

value

string

值,用于对话框中传值,

inputType

string

"text"--输入普通字符, "textCapCharacters"--输入普通字符, "textCapWords"--单词首字母大小, "textCapSentences"--仅第一个字母大小, "textAutoCorrect"--前两个自动完成, "textAutoComplete"--前两个自动完成, "textMultiLine"--多行输入, "textUri"--URI格式, "textEmailAddress"--电子邮件地址格式, "textEmailSubject"--邮件主题格式, "textShortMessage"--短消息格式, "textLongMessage"--长消息格式, "textPersonName"--人名格式, "textPostalAddress"--邮政格式, "textPassword"--密码格式,, "textVisiblePassword"--密码可见格式, textWebEditText"--作为网页表单的文本格式, "textFilter"--文本筛选格式, "textPhonetic"--拼音输入格式, "number"--数字格式,, "numberSigned"--有符号数字格式,, "numberDecimal"--可以带小数点的浮点格式,, "phone"--拨号键盘, "datetime","date"--日期键盘, "time"--时间键盘

width

int

height

int

color

string

颜色

background

string

背景色

colorLink

string

文字链接的颜色.

scaleX

float

设置文字之间间隔,默认为 1.0f。分别设置 0.5f/1.0f/1.5f/2.0f

shadowColor

string

指定文本阴影的颜色,需要与 shadowRadius 一起使用。

shadowRadius

float

设置阴影的半径。设置为 0.1 就变成字体的颜色了,一般设置为 3.0 的效果比较好

scaleType

 

设置图片的填充方式

src

string

设置图片按钮的 drawable

autoLink

 

设置是否当文本为 URL 链接/email/电话号码/map 时,文本显示为可点击的链接。可选值 (none/web/email/phone/map/all)

digits

string

设置允许输入哪些字符。如“1234567890.+-*/%\n()”

size

int

文字大小

style

int

设置字形[bold(粗体) 0, italic(斜体) 1, bolditalic(又粗又斜) 2] 可以设置一个或多个,用“|”隔开

typeface

int

文本字体,必须是以下常量值之一:normal 0, sans 1, serif 2, monospace(等宽字体) 3]

singleLine

bool

单行显示后面用“…”来表示

 

 

 

 

服务/解析类ttyu.helper

界面助手类ttyu.helper.block

方法

说明

publicobject LoadBlock(string blockName,string[] items)

装载块

publicobjectCreateBlock(string blockName)

建立块

publicobject LoadHeader(string[] items)

 

publicobject LoadHeader(string[] items)

 

publicobject LoadHeader(string[] items)

 

public List<Field>CreateBlock (string[] items)

建立块内元素

publicTextViewCreateTextView (Field field)

建立文本显示控件

publicEditTextCreateEditText (Field field)

建立可编辑文本控件

publicButtonCreateButton (Field field)

建立按钮控件

publicImageButtonCreateImageButton (Field field)

建立图片按钮

publicImageViewCreateImageView (Field field)

建立图片

publicCheckBoxCreateCheckBox (Field field)

建立多项选择控件

publicRadioButtonCreateRadioButton (Field field)

建立单选框控件

publicRadioGroupCreateRadioGroup (Field field)

建立单选框控件分组

public AnalogClock CreateAnalogClock (Field field)

建立钟表(带表盘)控件

public DigitalClock CreateDigitalClock (Field field)

建立电子表控件控件

public DatePicker CreateDatePicker (Field field)

建立日期选择控件控件

public TimePicker CreateTimePicker (Field field)

建立时间选择控件控件

publicToggleButtonCreateToggleButton (Field field)

建立双状态按钮控件

publicToastCreateToast (Field field)

建立提示控件

public Spinner CreateSpinner (Field field)

建立下拉列表控件

publicProgressBarCreateProgressBar (Field field)

建立(进度条控件

publicSeekBarCreateSeekBar (Field field)

建立可拖动的进度条控件

publicAutoCompleteTextViewCreateAutoCompleteTextView (Field field)

建立 AutoCompleteTextView自动完成的可编辑文本控件

publicMultiAutoCompleteTextView CreateMultiAutoCompleteTextView (Field field)

建立MultiAutoCompleteTextView输入多值控件

publicZoomControlsCreate ZoomControls(Fieldfield)

ZoomControls - 放大/缩小按钮控件

publicIncludeCreateInclude (Field field)

Include - 整合控件

publicVideoViewCreateVideoView (Field field)

VideoView - 视频播放控件

publicWebView Create WebView (Field field)

WebView - 浏览器控件

publicRatingBar CreateRatingBar (Field field)

RatingBar - 评分控件

publicChronometerCreateChronometer(Field field)

Chronometer - 计时器控件

publicScrollViewCreateScrollView (Field field)

ScrollView - 滚动条控件

publicTextSwitcher CreateTextSwitcher (Field field)

TextSwitcher - 文字转换器控件(改变文字时增加一些动画效果)

publicGallery CreateGallery (Field field)

Gallery - 缩略图浏览器控件

publicImageSwitcher CreateImageSwitcher  (Field field)

ImageSwitcher - 图片转换器控件(改变图片时增加一些动画效果)

publicGridView CreateGridView(Field field)

GridView - 网格控件

publicListView CreateListView (Field field)

ListView - 列表控件

publicExpandableList CreateExpandableList(Field field)

ExpandableList - 支持展开/收缩功能的列表控件

publicContextMenu CreateContextMenu(Field field)

ContextMenu-上下文菜单

publicDialogCreateDialog(Field field)

Dialog-对话框

 

 

 

 

 

 

 

 

 

 

模板定义与程序开发

8.     页面初使化init

stringparas ="backColor:#ffff,full:true";//定义选项卡

Ttyu.Helper.init (this,paras);

 

9.     选项卡Tab

2.1 一般选项卡

//定义选项卡的各子项

string[] items ={

"text: 首页,,goPage:a1",

"text: 服务,goPage:a2",

"text: 活动,goPage:a3",

"text: 话题,,goPage:a4"};

//装载默认的选项卡

Ttyu.Helper.LoadTab(this,items);

stringTab1="type:0";//定义选项卡

Ttyu.Helper.LoadTab (this,Tab1,items);

 

2.2 带图标的选项卡

 

stringtab1="type:upImage,height:80,backColor:#3045ff";//定义选项卡

//定义选项卡的各子项

string[] items ={

"image:a1.jpg,text:社区,,goPage:a1",

"image:a2.jpg,text:办公,goPage:a2",

"image:a3.jpg,text:联系,goPage:a3",

"image:a4.jpg,text:我的,,goPage:a4"};

//装载选项卡

Ttyu.Helper.LoadTab(this,tab1,items);

1.3 带分隔线的选项卡

 

stringTab1="type:line,height:80,backColor:#3045ff";//定义选项卡

//定义选项卡的各子项

string[] items ={

"text: 意见反馈,goPage:a1",

"text: 常见问题,goPage:a2"}

//装载选项卡

Ttyu.Helper.LoadTab(this,Tab1,items);

 

10. 轮播图Carouse

3.1 本地资源的轮播图

//定义本地资源的轮播图.说明:值中有,的要用[]括起来

stringcarouse1 ="type:0,height:80,keys:[a1.jpg,a2.jpg,a3,jpg,a4,jpg]";

Ttyu.Helper.LoadCarouse (this,carouse1);

3.2网络资源的轮播图

 

//定义网络资源,,图片关联数据库

stringcarouse1 ="type:1,height:100,keys:selecttop 4 PicName from Sys_User_Users where id>100";

Ttyu.Helper.LoadCarouse (this,carouse1);

11. 头部Header

4.1 默认头部

 

//按系统默认值,只需要定义头部中的各元素

string[] items ={

"type:leftImage",//默认的左箭头键,返回上页

"type: text,text:我的标题",

"type: button,text:保存,on:click"

};

//装载选项卡

Ttyu.Helper.LoadHeader (this,items);

 

4.2 自定义头部

//定义头部

stringheader="height:50, backColor:red";

Ttyu.Helper.LoadHeader (this,header,carouse1);

 

12. 表格/列表Table

5.1 带表头的表格

 

//定义带搜索的表格

stringtable="keys:[selectid,RoomName,LastScale,Scale from Park_ReadingMeter] ";

 

//定义表格的头部及绑定的字段

string[] items ={

"text:房源,field:RoomName",//

"text:上次刻度,field:LastScale",//

"text:本次刻度,field:Scale ",

"image:right "

};

//装载表格

Ttyu.Helper.LoadTable(this,table,items);

 

5.2带搜索的表头表格

//定义带搜索的表格

stringtable="searchType:2,keys:[selectid,RoomName,LastScale,Scale from Park_ReadingMeter] ";

 

//定义表格的头部及绑定的字段

string[] items ={

"text:房源,field:RoomName",//

"text:上次刻度,field:LastScale",//

"text:本次刻度,field:Scale ",

"image:right "

};

//装载表格

Ttyu.Helper.LoadTable(this,table,items);

 

5.3图文混排列表

 

//定义图文混排列表

stringtable="type:leftImage,rowHeight:100line:5,,keys:[tableName=vParkRoom&rows=4&page=0&where=1=1order by id desc] ";

 

//定义表格的头部及绑定的字段

string[] items ={

"image:RoomImage,width:50,height:50,type:rent",

"field:RoomName,color:black,size:14,style:bold ",

"field:Price,color:red",

"field:City",

"field:Area ",

"field:Area ",

"field:SendDate",

"field:BrowseCount",

"line:1 ",

"type:text,text:发布者",

"field:Name ",

"field:Level "

};

Ttyu.Helper.LoadTable(this,table,items);

 

5.4分组列表

 

//定义图文混排列表

stringtable="type:group,groupField:type,rowHeight:100line:5,,keys:[tableName=vParkRoom&rows=4&page=0&where=1=1order by id desc] ";

 

//定义表格的头部及绑定的字段

string[] items ={

"image:RoomImage,width:50,height:50,type:rent",

"field:RoomName,color:black,size:14,style:bold ",

"field:Price,color:red",

"field:City",

"field:Area ",

"field:Area ",

"field:SendDate",

"field:BrowseCount",

"line:1 ",

"type:text,text:发布者",

"field:Name ",

"field:Level "

};

Ttyu.Helper.LoadTable(this,table,items);

 

 

13. 功能菜单列表/网络Menu

6.1 带线条的网格,每行4列

 

//定义网络

stringmenu1="type:grid4,height:100";

 

//定义网络内的元素

string[] items ={

"image:a1.jpg,text:签到,goPage:c1", //

"image:a2.jpg,text:管理日历,goPage:c2",

"image:a3.jpg,text:公告,goPage:c3",

"image:a4.jpg,text:审批,goPage:c4",

"image:a5.jpg,text:商务电话,goPage:c5",

"image:a6.jpg,text:日志,goPage:c6"

};

//装载网络

Ttyu.Helper.LoadMenu(this,menu1,items);

6.2 带线条的网格,默认为3列

 

//定义网络内的元素

string[] items ={

"image:a1.jpg,text:请假,goPage:c1", //

"image:a2.jpg,text:报销,goPage:c2",

"image:a3.jpg,text:出差,goPage:c3",

"image:a4.jpg,text:审批,goPage:c4",

"image:a5.jpg,text:商务电话,goPage:c5",

"image:a6.jpg,text:日志,goPage:c6"

};

//装载网络

Ttyu.Helper.LoadMenu(this,items);

 

6.3 没带线条的网格,默认为3列

 

//定义网络

stringmenu1="line:0";

 

//定义网络内的元素

string[] items ={

"image:a1.jpg,text:请假,goPage:c1", //

"image:a2.jpg,text:报销,goPage:c2",

"image:a3.jpg,text:出差,goPage:c3",

"image:a4.jpg,text:审批,goPage:c4",

"image:a5.jpg,text:商务电话,goPage:c5",

"image:a6.jpg,text:日志,goPage:c6"

};

//装载网络

Ttyu.Helper.LoadGrid(this,menu1,items);

6.4 随机排列

 

//定义网络

stringgrid1="type:rand";

 

//定义网络内的元素

string[] items ={

"image:a1.jpg,goPage:c1", //

"image:a2.jpg,goPage:c2",

"image:a3.jpg,goPage:c3",

"image:a4.jpg,goPage:c4",

"image:a5.jpg,goPage:c5"

};

//装载网络

Ttyu.Helper.LoadMenu(this,grid1,items);

 

 

6.5行排列菜单

//定义网络

stringgrid1="type:row,height:200";

 

//定义网络内的元素

string[] items ={

"image:a1.jpg,text:直租,goPage:c1", //

"image:a2.jpg,text:直聘,goPage:c2",

"image:a3.jpg,text:直购,goPage:c3",

"image:a4.jpg,text:保洁,goPage:c4",

"image:a5.jpg,text:维修,goPage:c5",

"image:a6.jpg,text:装修,goPage:c6"

};

//装载网络行

Ttyu.Helper.LoadMenu(this,grid1,items);

6.6主副标题行排列菜单

 

//定义网络

stringgrid1="type:two,height:200,line:5";

 

//定义网络内的元素

string[] items ={

"image:a1.jpg,text:签约专享双周保洁,value:360度无死角,深度清洁, goPage:c1",

"image:a2.jpg,text:直聘,goPage:c2",

"image:a3.jpg,text:直购,goPage:c3",

"image:a4.jpg,text:保洁,goPage:c4",

"image:a5.jpg,text:维修,goPage:c5",

"image:a6.jpg,text:装修,goPage:c6"

};

//装载网络

Ttyu.Helper.LoadMenu(this,grid1,items);

 

6.7分组行排列菜单

 

 

//定义网络

stringgrid1="type:group,height:200,line:5";

 

//定义网络内的元素

string[] items ={

"image:a1.jpg,text:签约专享双周保洁,value:360度无死角,深度清洁, goPage:c1",

"image:a2.jpg,text:直聘,goPage:c2",

"image:a3.jpg,text:直购,goPage:c3",

"image:a4.jpg,text:保洁,goPage:c4",

"image:a5.jpg,text:维修,goPage:c5",

"image:a6.jpg,text:装修,goPage:c6"

};

//装载网络

Ttyu.Helper.LoadGridRow(this,grid1,items);

 

 

14. 可编辑表单EditForm

7.1带实线条的可编辑表单

//定义表单

stringform1="height:500,table:user";

 

//定义每行内容

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:text, text:所在城市",

"type:editText,text:选择城市",

"type:image,src:right,"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:户型",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             }

}

 //装载选项卡

Ttyu.Helper.LoadForm(this,form1,rows);

 

 

 

7.2分组可编辑表单

//定义表单

stringeditForm="type:group,height:500";

 

//定义每行内容

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:text, text:所在城市",

"type:editText,text:选择城市",

"type:image,src:right,"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:户型",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             }

          }

 //装载选项卡

Ttyu.Helper.LoadForm(this,editForm,rows);

 

 

//定义表单

stringeditForm="type:group,height:500";

 

//定义每行内容

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:text, text:所在城市",

"type:editText,text:选择城市",

"type:image,src:right,"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:户型",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             }

          }

 //装载选项卡

Ttyu.Helper.LoadEditForm(this,editForm,items);

 

 

 

7.3行显示表单

//定义表单

stringeditForm="type:show,height:500";

 

//定义每行内容

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:text, text:所在城市",

"type:editText,text:选择城市",

"type:image,src:right,"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:户型",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             }

          }

 //装载选项卡

Ttyu.Helper.LoadEditForm(this,editForm,items);

 

 

 

7.4行分组显示表单

//定义表单

stringeditForm="type:showGroup,height:500";

 

//定义每行内容

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:text, text:所在城市",

"type:editText,text:选择城市",

"type:image,src:right,"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:户型",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             }

          }

 //装载选项卡

Ttyu.Helper.LoadEditForm(this,editForm,items);

 

7.5线性显示显示表单

//定义表单

stringeditForm="type:showLine,height:500";

 

//定义每行内容

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:text, text:所在城市",

"type:editText,text:选择城市",

"type:image,src:right,"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:户型",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             }

          }

 //装载选项卡

Ttyu.Helper.LoadEditForm(this,editForm,items);

 

7.6显示表单明细showItem

//定义表单

stringeditForm="type:showItem,height:500";

 

//定义每行内容

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:text, text:所在城市",

"type:editText,text:选择城市",

"type:image,src:right,"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:户型",

"type:editText,text:小区名字",

"type:image,src:right"

             },

{

"type:text, text:小区名称",

"type:editText,text:小区名字",

"type:image,src:right"

             }

          }

 //装载选项卡

Ttyu.Helper.LoadEditForm(this,editForm,items);

 

 

 

15. 按钮组buttons

8.1单个按钮

 

8.2文字按钮组

 

 

8.3带图标的按钮组

 

 

8.4分组按钮组

 

 

//定义表单

stringeditForm="height:500,top,5,backColor:red,line:1 ";

 

//按系统默认值,只需要定义头部中的各元素

string[4][] rows ={//4行,每行又由多个元素构成

            {

"type:image, file: left, width: 50, height: 50,float:left,openMode:MyApp1:1|2|3|4",

"type:text, text: À¨º¬a, color:, width: 50,height: 50, fontSize: 14, fontWeight:bold, float:left"

             },

            {

"type:image, file: left, width: 50, height:50,float:left,openMode:MyApp1:1|2|3|4",

"type:text, text: À¨º¬a, color:, width: 50,height: 50, fontSize: 14, fontWeight:bold, float:left"

             }

//装载选项卡

Ttyu.Helper.LoadEditForm(this,editForm,items);

 

16. 对话框Dialog

10.1带单选圆按钮的对话框

//定义单选窗口

stringwin="type:select,title:请选择,titleBackColor:#3621ff,value:事假|病假|年假|调休|婚假|产假|陪产假|路途假|其他";

10.2带“确认”和“取消”的提示框

//定义单选窗口

stringwin="type:yes,value:确认要退出吗?";

10.3带“确认”和“取消”的输入框

//定义单选窗口

stringwin="type:yes,value:确认要退出吗?";

 

10.4带多按钮的的内容选择框

//定义单选窗口

stringwin="type:yes,value:确认要退出吗?";

10.5多选框

 

 

10.6列表框

17. 下拉列表Spinner

11.1下拉列表

http://www.cnblogs.com/tinyphp/p/3858920.html

11.2带单选圆按钮的下拉菜单

http://www.oschina.net/question/54100_33274

 

11.3多级下拉列表

http://www.2cto.com/kf/201409/336647.html

 

11.4多数据排列的下拉列表

 

tag:设置控件的动作action,表示将要做什么。在父容器或者打开视图的控件中设置

示例:

android:tag="getRow

说明:获取表中一行数据,常用于明细页的数据展示

 

android:tag="getRows

说明:获取表数据,常用于翻页的列表控件

 

android:tag="getRowBySql

说明:把接口的单行数据写入容器内的所有相匹配的子控件上,常用于明细页的数据展示

 

android:tag="getRowsBySql

说明:把接口的多行数据写入容器内的列表控件里的所有相匹配的子控件上,卽显示多行数据

 

android:tag="insertRow

说明:向表中插入一行数据

 

android:tag="updateRow

说明:更新表的数据

 

android:tag="delete

说明:删除表的数据

 

android:tag="goView

说明:跳转到新视图

 

android:tag="validate

说明:验证

 

android:tag="upLoad

说明:上传文件

 

android:tag="login

说明:登录

 

android:tag="updatePsd

说明:更新密码

 

android:tag="isYesPSD

说明:密码是否正确

 

android:tag="getCheckCode

说明:获取验证码

 

android:tag="isExist

说明:表中是否存在满足条件的数据行

 

android:tag="getValue

说明:获取表中字段的值

 

android:tag="getValues

说明:获取表中字段的值

 

android:tag="getRecordCount

说明:获取表的行数

 

android:tag="getTableField

说明:获取表的字段

 

android:tag="query

说明:查询

 

contentDescription:设置服务接口参数

示例:

android:tag="getRow"

android:contentDescription="tableName=vParkRoom&where id=1"

说明:显示接口的sql语句的数据

 

android:tag="getRows"

android:contentDescription="tableName=doc&rows=9&page=0&where=ParentID=1"

说明:从表doc取满足条件的首页,每页9

 

android:tag="showData"

android:contentDescription="sql=select * from vParkRoom whereid=1"

说明:显示接口的sql语句的数据

 

android:tag="showDatas"

android:contentDescription="sql=select id,ParkName from Park whereProvince='北京'"

说明:显示接口的sql语句的数据,循环显示

 

android:tag="insert

android:contentDescription="tableName=Park_LookRoom"

说明:向表Park_LookRoom插入一条数据

android:tag="update

android:contentDescription="tableName=Park_Flats&where=ID=1"

说明:更新表Park_Flats中满足条件的所有数据

 

android:tag="delete

android:contentDescription="tableName=Park_Flats&where=ID=1"

说明:删除表Park_Flats中满足条件的所有数据

 

android:contentDescription="action=upLoad"

说明:

 

contentDescription:设置验证参数

示例:

android:contentDescription="NoNull:矿山名称"

说明:矿山名称不能为空

 

android:contentDescription="LenMax:10,矿山编号"

说明:矿山编号的最大长度不能超过10

 

android:contentDescription="NoNull:登陆名称|NoCan:登陆名称,输入您的登陆名称|IsOnly:Sys_User_Users"

说明:登陆名称不能为空并且登陆名称不能是输入您的登陆名称并且登陆名称在表Sys_User_Users中必须是唯一的

 

android:contentDescription="^\d{13}$|^C\d{22}$:采矿许可证号只能是13位数字或者以C开头的22位数字"

说明:采矿许可证号通过正则表达式验证,出错时的信息为采矿许可证号只能是13位数字或者以C开头的22位数字

 

contentDescription设置变量:@xx@

示例:

"sql=select * from Sys_BaseData_Doc where id=@id@"

说明:@id@表示前页传递的参数.:id=100等价于

"sql=select * from Sys_BaseData_Doc where id=100"

 

"tableName=doc&where=ParentID=@id@ and name like ‘%@name@%’"

说明:@id@@name@表示前页传递参数.:id=100,name=等价于

"tableName=doc&where=ParentID=100 and name like ‘%%’"

contentDescription打开视图:viewName

示例:

"viewName=my"

说明:打开xml资源名称为myActivity

 

"viewName=my&paras=id=1"

说明:打开xml资源名称为myActivity并且传递参数id=1

 

"viewName=my &paras=id=[getValue:0,id]"

说明:打开xml资源名称为myActivity并且传递参数id,id的值来自方法getValue

 

"viewName=my &paras=id=[getValue:0,id]&name=张三"

说明:多参数

 

contentDescription调用方法:[]

示例:

"viewName=my &id=[getValue:0,id]"

说明:[getValue:0,id]表示执行方法getValue,参数0,id,取数据的0行的id

 

Ttyu.Server类:服务类,调用远程接口,返回数据

方法

说明

DoServiceByUrl (string url)

调用服务接口url,返回JSON对象

DoService (string action, stringpara)

执行action动作,返回JSON对象

 

 

 

Ttyu.View视图控制类

 

方法

说明

LoadXmlResources (string xmlResName)

装载xml资源文件

DoView (View view)

解析xml资源文件的根视图

ShowSubViewsData (View view)

把接口数据写入容器内的所有相匹配的子控件,显示出数据

SaveSubViewsData (stringviewName)

向服务器发送容器内的所有相匹配的子控件的数据

GoView (View view)

跳转到新视图

 

 

Validate(string funcs,string value)

通过服务接口验证控件的值是否合法

GetSubViewsKeyValues (View view)

获取容器内的所有相匹配的子控件的键值数据对

GetViewID(string viewName)

通过资源名获取资源ID

Name2Id (string viewName)

资源名称转换成资源Id

 

 

Ttyu. Validate验证类

方法

说明

IsMail

邮箱地址

IsChina

只允许中文字符

IsTel

国内电话号码

NoNull

不能为空

NoEqual

不等于

NoCan

不能

IsModulCode

国内手机号码11位数字码

IsIP

IP地址,如: 192.168.1.100

IsInt

Int型,如: 45 或 888

IsNumber

数字型,非字符,如: 111 或 -094

IsLengthStr

字符串的长度是不是在限定数之间

IsPostCode

邮政编码 6个数字,如: 100000 或 437100

IsNormalChar

正常字符字母,数字,下划线的组合,但不包括如【~ @ ! $ # % ...】等,如: abyu 或 13946662511

IsQq0

匹配腾讯QQ号,如: 39062477 或 4500983

IsAlphanumber

只有字母或数字或_,如: a131466_62511 或 1394666251

IsOnly

数据唯一,不能重复

LenMax

数据长度不能超过len位

LenMin

数据长度不能少于len位

Len

数据长度只能是len位

Number

数据长度只能是len位的数字类型

NumberBetween

一定范围内的数字类型

 

 

 

Ttyu.String字符串处理类

 

方法

说明

GetBefore(thisstring str, string subStr)

得到字符串中子字符串的前部分

GetBeforeLast (thisstring str, string subStr)

得到字符串中最后子字符串的前部分

GetAfter(thisstring str, string subStr)

得到字符串中子字符串的后部分

GetAfterLast(thisstring str, string subStr)

得到字符串中最后子字符串的后部分

GetBetween(this string str, string StartText, string EndText)

得到字符串的中间部分的字符串

 

 

 

0 0
原创粉丝点击